From b91ea94543a0825d86e73571300606f4039f1724 Mon Sep 17 00:00:00 2001 From: mrexodia Date: Sun, 9 Apr 2017 20:42:45 +0200 Subject: [PATCH] code improvements to RCoreLocked --- src/qrcore.cpp | 3 ++- src/qrcore.h | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/qrcore.cpp b/src/qrcore.cpp index 7532376a..dbbb14cc 100644 --- a/src/qrcore.cpp +++ b/src/qrcore.cpp @@ -10,8 +10,9 @@ RCoreLocked::RCoreLocked(RCore *core) } RCoreLocked::RCoreLocked(RCoreLocked&& o) + : core(o.core) { - core = o.core; + o.core = nullptr; } RCoreLocked::~RCoreLocked() diff --git a/src/qrcore.h b/src/qrcore.h index 751fcfee..55513fca 100644 --- a/src/qrcore.h +++ b/src/qrcore.h @@ -27,8 +27,11 @@ #define __alert(x) QMessageBox::question (this, "Alert", QString(x), QMessageBox::Ok) #define __question(x) (QMessageBox::Yes==QMessageBox::question (this, "Alert", QString(x), QMessageBox::Yes| QMessageBox::No)) -struct RCoreLocked +class RCoreLocked { + RCore* core; + +public: explicit RCoreLocked(RCore* core); RCoreLocked(const RCoreLocked&) = delete; RCoreLocked& operator=(const RCoreLocked&) = delete; @@ -36,9 +39,6 @@ struct RCoreLocked ~RCoreLocked(); operator RCore*() const; RCore* operator->() const; - -private: - RCore* core; }; #define QNOTUSED(x) do { (void)(x); } while ( 0 );