Closed Bug 671625 Opened 14 years ago Closed 14 years ago

AddDefaultGateway does not check gateway for validity

Categories

(Other Applications Graveyard :: PyXPCOM, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mark.yen, Assigned: mark.yen)

Details

Attachments

(1 file, 1 obsolete file)

AddDefaultGateway does not ensure that the gateway is still alive, just that the object has an attribute of the right name. This means that, for a python object O implementing interface I, if you 1) Get a O -> I wrapper, 2) Release it (so the wrapper dies), 3) Get a new O -> I wrapper, O will still think it has a default gateway (that is long dead), instead of the new one. See attached patch. For more concrete STR, grab a debug build of Komodo, set it to open nothing on startup (not even the start page), then restart, and open a recent project from the menu. It aborts in PyG_Base::AutoWrapPythonInstance with a koProject with "Auto-wrapped object didn't get a default gateway!".
Attachment #545966 - Flags: review?(toddw)
Attachment #545966 - Attachment is patch: true
Is there a test case that can be added to check this?
Attached patch now with a testSplinter Review
Turns out it involves wrapping the object during repr() (in the koProject case, ultimately it tried to add itself as an observer to the pref observer service in __repr__).
Assignee: nobody → marky
Attachment #545966 - Attachment is obsolete: true
Attachment #546816 - Flags: review?(toddw)
Attachment #545966 - Flags: review?(toddw)
Attachment #546816 - Flags: review?(toddw) → review+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
There was a missing "PyErr_Clear();" for the PyObject_GetAttrString call, to clear the exception when there was no "PyXPCOM_szDefaultGatewayAttributeName" attribute set on the object. Added in change: http://hg.mozilla.org/pyxpcom/rev/2cce3102916e
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: