diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-19 04:29:33 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-22 17:26:42 +0200 |
commit | 667f53b522d6181ca3794e0d45d52bc1b069a513 (patch) | |
tree | 7fdd3949f15b9fee6cc85ef5439e9716f19229be /src/libcamera/object.cpp | |
parent | b6d93f977239d293bfe0eb7b8fca1c12ff9e18d2 (diff) |
libcamera: signal: Make slots list private
The slots list is touched from most of the Signal template functions. In
order to prepare for thread-safety, move handling of the list to a small
number of non-template functions in the SignalBase class.
This incidently fixes a bug in signal disconnection handling where the
signal wasn't removed from the object's signals list, as pointed out by
the signals unit test.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/object.cpp')
-rw-r--r-- | src/libcamera/object.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp index 21aad565..f2a8be17 100644 --- a/src/libcamera/object.cpp +++ b/src/libcamera/object.cpp @@ -76,7 +76,12 @@ Object::Object(Object *parent) */ Object::~Object() { - for (SignalBase *signal : signals_) + /* + * Move signals to a private list to avoid concurrent iteration and + * deletion of items from Signal::disconnect(). + */ + std::list<SignalBase *> signals(std::move(signals_)); + for (SignalBase *signal : signals) signal->disconnect(this); if (pendingMessages_) |