From 06008b9156b74885aa2382dec9dc8c7854ca6f2e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 28 Oct 2019 05:44:14 +0200 Subject: libcamera: object: Use bound method activePack() for invokeMethod() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BoundMethodBase::activatePack() and the internal Object::invokeMethod() are duplicate implementation of the same mechanism. Use the former to replace the latter. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/bound_method.h | 4 ++-- include/libcamera/object.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index 06c5a3b1..bdeb5469 100644 --- a/include/libcamera/bound_method.h +++ b/include/libcamera/bound_method.h @@ -37,7 +37,7 @@ public: Object *object() const { return object_; } ConnectionType connectionType() const { return connectionType_; } - void activatePack(void *pack); + void activatePack(void *pack, bool deleteMethod); virtual void invokePack(void *pack) = 0; protected: @@ -109,7 +109,7 @@ public: void activate(Args... args) { if (this->object_) - BoundMethodBase::activatePack(new PackType{ args... }); + BoundMethodBase::activatePack(new PackType{ args... }, false); else (static_cast(this->obj_)->*func_)(args...); } diff --git a/include/libcamera/object.h b/include/libcamera/object.h index 3308330a..603a2292 100644 --- a/include/libcamera/object.h +++ b/include/libcamera/object.h @@ -33,10 +33,12 @@ public: void invokeMethod(void (T::*func)(Args...), Args... args) { T *obj = static_cast(this); - BoundMethodBase *method = new BoundMemberMethod(obj, this, func); + BoundMethodBase *method = + new BoundMemberMethod(obj, this, func, + ConnectionTypeQueued); void *pack = new typename BoundMemberMethod::PackType{ args... }; - invokeMethod(method, pack); + method->activatePack(pack, true); } Thread *thread() const { return thread_; } @@ -53,8 +55,6 @@ private: friend class BoundMethodBase; friend class Thread; - void invokeMethod(BoundMethodBase *method, void *pack); - void notifyThreadMove(); void connect(SignalBase *signal); -- cgit v1.2.1