Opened on 12/06/2015 at 07:25:07 PM
Last modified on 01/08/2016 at 03:07:07 PM
#3382 new defect
[meta] Rationalize life cycle of plugin classes
Reported by: | eric@adblockplus.org | Assignee: | |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Adblock-Plus-for-Internet-Explorer | Keywords: | |
Cc: | Blocked By: | #3383, #3391, #3394, #3397, #3432, #3433, #3456 | |
Blocking: | Platform: | Internet Explorer | |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description (last modified by eric@adblockplus.org)
Background
The plugin classes were hacked together originally and have a large amount of ad hoc behavior with their life cycles. There are multiple initialization in multiple places, redundant deinitializations, some problems with objects going out scope still being referenced, etc. This has led to both actual defects as well as convoluted control code to work around poor class design.
The focus here is on classes that have contact directly with IE: the BHO COM class CPluginClass, protocol and media type classes associated with PassthroughAPP, and also the classes whose life cycle are directly dependent upon these.
What to fix
Classes should adhere to some fundamental implementation patterns.
- Paired operations should occur in within natural implementation pairs: constructor / destructor, SetSite() with nullptr / non-nullptr argument, (if required) ATL implementation functions FinalConstruct / FinalRelease.
- The life span of a dependent object is strictly contained within the life span of the object it depends upon.
- As an important special case, users of a shared resource should hold a shared_ptr (or something containing one) to the resource, ensuring strict life span containment.
- The life span of an event handler should strictly contain the duration of registration for the events it handles.
- Classes with deferred and/or long-running initialization should use a uniform mechanism to determine when the initialization is complete.
Attachments (0)
Change History (10)
comment:2 Changed on 12/06/2015 at 07:43:19 PM by eric@adblockplus.org
- Blocked By 3383 added
comment:3 Changed on 12/08/2015 at 04:01:27 PM by eric@adblockplus.org
- Blocked By 3391 added
comment:4 Changed on 12/08/2015 at 05:55:35 PM by eric@adblockplus.org
- Blocked By 3394 added
comment:5 Changed on 12/09/2015 at 01:36:46 PM by eric@adblockplus.org
- Blocked By 3397 added
comment:6 Changed on 12/17/2015 at 02:54:49 PM by eric@adblockplus.org
- Blocking 3432 added
comment:7 Changed on 12/17/2015 at 03:43:30 PM by eric@adblockplus.org
- Blocked By 3433 added
comment:8 Changed on 12/23/2015 at 04:23:27 PM by eric@adblockplus.org
- Blocked By 3456 added
comment:9 Changed on 01/08/2016 at 02:00:16 PM by eric@adblockplus.org
- Priority changed from Unknown to P3
comment:10 Changed on 01/08/2016 at 03:07:07 PM by eric@adblockplus.org
- Blocked By 3432 added
- Blocking 3432 removed
- Description modified (diff)