Closed Bug 160567 Opened 22 years ago Closed 11 years ago

Documentation: add comments explaining possible crash in scriptable object code

Categories

(Core Graveyard :: Plug-ins, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: serhunt, Assigned: danielwang)

References

()

Details

A comment should be added to the paragraph Making Plug-ins Scriptable in
implementation example of NPP_Destroy function. Here is what I just added to the
article http://mozilla.org/projects/plugins/scripting-plugins.html from where
the code was actually taken:

NPError NPP_Destroy (NPP instance, NPSavedData** save)
{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  // release the scriptable object 
+ // Note that even though we release it here it does not necesserely
+ // mean that its refcount will go to zero and it will be deleted.
+ // XPCOM code in the browser may still hold more outstanding 
+ // references to this object and even execute calls to it at some
+ // later time, when other plugin objects no longer exist. So in real 
+ // implementations some measures of precaution must be taken here to 
+ // prevent crash such as notifying the scriptable object that there
+ // may be some dangling pointers and it is not safe to use them any more
  NS_IF_RELEASE(instance->pdata);
}
Blocks: 115266
Blocks: 207938
moving stuff over to an outside-the-firewall email for the time being, looking
for people to pick these Help and doc bugs up for me.
Assignee: oeschger → oeschger
taking over some of Ian's bugs
Assignee: oeschger → stolenclover
QA Contact: shrir → plugins
XPCOM plugins are gone.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.