Opened 2 years ago

Last modified 23 months ago

#3382 new defect

[meta] Rationalize life cycle of plugin classes

Reported by: eric@… 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@…)

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.


Change History (10)

comment:1 Changed 2 years ago by eric@…

  • Description modified (diff)

comment:2 Changed 2 years ago by eric@…

  • Blocked By 3383 added

comment:3 Changed 2 years ago by eric@…

  • Blocked By 3391 added

comment:4 Changed 2 years ago by eric@…

  • Blocked By 3394 added

comment:5 Changed 2 years ago by eric@…

  • Blocked By 3397 added

comment:6 Changed 2 years ago by eric@…

  • Blocking 3432 added

comment:7 Changed 2 years ago by eric@…

  • Blocked By 3433 added

comment:8 Changed 2 years ago by eric@…

  • Blocked By 3456 added

comment:9 Changed 23 months ago by eric@…

  • Priority changed from Unknown to P3

comment:10 Changed 23 months ago by eric@…

  • Blocked By 3432 added
  • Blocking 3432 removed
  • Description modified (diff)
Note: See TracTickets for help on using tickets.