From 7df177fd889624c4b149ba2ecabb4969ad8c2bee Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 27 Nov 2019 05:16:56 +0200 Subject: libcamera: object: Document danger of deleting object from other thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Object instances receive messages dispatched from the event loop of the thread they belong to. Deleting an object from a different thread is thus dangerous, unless the caller ensures that no message delivery is in progress. Document this in the Object class documentation. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- src/libcamera/object.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp index 1f787271..e76faf48 100644 --- a/src/libcamera/object.cpp +++ b/src/libcamera/object.cpp @@ -40,6 +40,10 @@ LOG_DEFINE_CATEGORY(Object) * implementing easy message passing between threads by inheriting from the * Object class. * + * Deleting an object from a thread other than the one the object is bound to is + * unsafe, unless the caller ensures that the object isn't processing any + * message concurrently. + * * Object slots connected to signals will also run in the context of the * object's thread, regardless of whether the signal is emitted in the same or * in another thread. -- cgit v1.2.1