libcamera: event_notifier_poll: Fix notifier unregistration during event processing
An event notifier may be unregistered from its activated signal. This can cause the notifiers set entry in notifiers_ to be deleted while processNotifiers() is looping over the notifiers_ map, leading to problems. To fix this, add a flag to the EventNotifierPoll class to indicate that event processing is in progress. If the flag is set, the notifiers_ entry is not deleted during notifier unregistration, but will be deleted by the event processing loop. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -45,6 +45,8 @@ private:
|
||||
std::list<Timer *> timers_;
|
||||
int eventfd_;
|
||||
|
||||
bool processingEvents_;
|
||||
|
||||
int poll(std::vector<struct pollfd> *pollfds);
|
||||
void processInterrupt(const struct pollfd &pfd);
|
||||
void processNotifiers(const std::vector<struct pollfd> &pollfds);
|
||||
|
||||
Reference in New Issue
Block a user