Opened on 12/17/2015 at 02:54:49 PM
Last modified on 01/08/2016 at 02:01:00 PM
#3432 new change
Treat COM events as a resource with RAII
Reported by: | eric@adblockplus.org | Assignee: | |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Adblock-Plus-for-Internet-Explorer | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #3382 | Platform: | Internet Explorer |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description
Background
The current way of registering events is ad hoc and somewhat unreliable. We have an explicit call to start events in one place and calls to stop them scattered throughout the code.
What to change
Treat a COM event registration as a resource and manage it with RAII. This simplifies the code, ensuring that events will automatically stop before the destruction of their sink object, eliminating any possibility of a null pointer dereference in the event source.
Stopping events is used to handle certain error conditions, but not in a particularly reliable way. Fixing this issue may require separating out these other concerns.