Issue 122405 - [sidebar] UI element's real interface is disposed
[sidebar] UI element's real interface is disposed
Product: General
Classification: Code
Component: code
All All
: P3 Normal (vote)
: 4.0.0
Assigned To: Andre
Depends on:
Blocks: [sidebar]
  Show dependency treegraph
Reported: 2013-05-29 08:18 UTC by Ariel Constenla-Haile
Modified: 2013-07-11 13:56 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

GDB backtrace (15.19 KB, text/plain)
2013-05-29 08:18 UTC, Ariel Constenla-Haile
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Ariel Constenla-Haile 2013-05-29 08:18:26 UTC
Created attachment 80743 [details]
GDB backtrace

Build the custompanel example from the SDK.
Run the example.
Attach the debugger.

Set two break points:
a) on the UI element's disposing()

b) on its tool panel disposing()

Activate the custompanel on the sidebar, switch to the gallery or the navigator panel.

sd::colortoolpanel::SingleColorPanel::disposing() is called before sd::colortoolpanel::PanelUIElement::disposing()

sfx2::sidebar::Panel::Dispose() is disposing the UI element's real interface, then the UI element itself:

    if (
        Reference<lang::XComponent> xComponent (mxElement->getRealInterface(), UNO_QUERY);
        if (

        Reference<lang::XComponent> xComponent (mxElement, UNO_QUERY);
        mxElement = NULL;
        if (

The real interface of the UI element is the UI element's responsibility (this means, when the UI element is disposed, it will free its resources, among other things, disposing its real interface - whatever that could be).
In the custompanel example, this is handled nicely by the C++ component implementation helper class. In other cases, it may end up in a crash, as with the Watching Window extension from
Comment 1 Andre 2013-05-29 08:58:56 UTC
This is left-over from the early days of sidebar development when the Impress panels where still view shell based and needed very special handling and had to be disposed at exactly the right time.

Disposing just the mxElement should be enough, now that the Impress panels are "regular" dialogs/controls.
Comment 2 SVN Robot 2013-05-29 13:19:17 UTC
"af" committed SVN revision 1487475 into trunk:
122405: Sidebar panels no longer dispose XUIElement's inner objects.
Comment 3 Andre 2013-05-29 13:22:13 UTC
The object returned by XUIElement::getRealInterface() is no longer disposed().  The XUIElement interface does not state who is responsible for the returned object it seems reasonable to assume that the XUIElement object is.  A quick look into two implementations of XUIElement confirms that.