Opened on 12/08/2015 at 04:01:27 PM
Last modified on 01/25/2016 at 12:49:09 PM
#3391 reviewing defect
Detached initialization is defective in corner cases and poorly structured
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): |
https://codereview.adblockplus.org/29332660/ |
Description
Background
Some classes require long-running initialization and perform it asynchronously in detached threads. CPluginClass performs some process-global initialization. Filters are loaded in a separate thread.
These operations are performed ad hoc and without consistency. Scoping is poor, with control not localized to the classes in which it's relevant. Synchronization is defined at point-of-use rather than within the defining scope of the variables it's initializating. Synchronization in destructors is missing entirely, with possible race conditions in short-lived objects.
What to change
- Perform detached initialization as close to the data structures being initialized. Scope such initialization code within class definitions when feasible.
- Provide a consistent way to determine that initialization has completed.
- Eliminate race conditions in destructors.