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 --- src/libcamera/bound_method.cpp | 6 +++--- src/libcamera/object.cpp | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp index 60071736..4c0cd415 100644 --- a/src/libcamera/bound_method.cpp +++ b/src/libcamera/bound_method.cpp @@ -48,7 +48,7 @@ namespace libcamera { * deadlock will occur. */ -void BoundMethodBase::activatePack(void *pack) +void BoundMethodBase::activatePack(void *pack, bool deleteMethod) { ConnectionType type = connectionType_; if (type == ConnectionTypeAuto) { @@ -66,7 +66,7 @@ void BoundMethodBase::activatePack(void *pack) case ConnectionTypeQueued: { std::unique_ptr msg = - utils::make_unique(this, pack); + utils::make_unique(this, pack, nullptr, deleteMethod); object_->postMessage(std::move(msg)); break; } @@ -75,7 +75,7 @@ void BoundMethodBase::activatePack(void *pack) Semaphore semaphore; std::unique_ptr msg = - utils::make_unique(this, pack, &semaphore); + utils::make_unique(this, pack, &semaphore, deleteMethod); object_->postMessage(std::move(msg)); semaphore.acquire(); diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp index b0818f9a..509b2eba 100644 --- a/src/libcamera/object.cpp +++ b/src/libcamera/object.cpp @@ -153,13 +153,6 @@ void Object::message(Message *msg) * remains valid until the method is invoked. */ -void Object::invokeMethod(BoundMethodBase *method, void *args) -{ - std::unique_ptr msg = - utils::make_unique(method, args, nullptr, true); - postMessage(std::move(msg)); -} - /** * \fn Object::thread() * \brief Retrieve the thread the object is bound to -- cgit v1.2.1