Issue 122405 - [sidebar] UI element's real interface is disposed
Summary: [sidebar] UI element's real interface is disposed
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 4.0.0-dev
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Andre
QA Contact:
URL:
Keywords:
Depends on:
Blocks: [sidebar]
  Show dependency tree
 
Reported: 2013-05-29 08:18 UTC by Ariel Constenla-Haile
Modified: 2022-10-28 12:54 UTC (History)
2 users (show)

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


Attachments
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()
sd::colortoolpanel::PanelUIElement::disposing()

b) on its tool panel disposing()
sd::colortoolpanel::SingleColorPanel::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 (mxElement.is())
    {
        Reference<lang::XComponent> xComponent (mxElement->getRealInterface(), UNO_QUERY);
        if (xComponent.is())
            xComponent->dispose();
    }

    {    
        Reference<lang::XComponent> xComponent (mxElement, UNO_QUERY);
        mxElement = NULL;
        if (xComponent.is())
            xComponent->dispose();
    }

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 http://extensions.openoffice.org/en/project/watchingwindow
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.