Issue 124623

Summary: Memory leak with extension's Options page
Product: General Reporter: Ariel Constenla-Haile <arielch>
Component: codeAssignee: Ariel Constenla-Haile <arielch>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: oliver.brinzing
Version: 3.3.0 or older (OOo)   
Target Milestone: 4.2.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 4.1.0-dev
Developer Difficulty: ---

Description Ariel Constenla-Haile 2014-04-07 23:00:37 UTC
Steps "to reproduce it":

- Create a C++ extension that adds Options pages to OpenOffice's Options dialog, see https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Options_Dialog

- The extension has to provide a component implementing com.sun.star.awt.XContainerWindowEventHandler, see https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Saving_and_Reading_Data_for_the_Options_Page

- The lifetime of this C++ UNO object is controlled by reference count. The application terminates without the object being deleted, with a reference count > 0.
Comment 1 Ariel Constenla-Haile 2014-04-07 23:18:02 UTC
The extension's event handler is kept alive by the dlgprov::DialogEventsAttacherImpl and its dlgprov::DialogUnoScriptListenerImpl holding a reference to it. These in turn are kept alive because they are listening at the toolkit controls. The toolkit controls are in turn kept alive because the one that creates the container window never disposes it.

Disposing m_xPage in ExtensionsTabPage::~ExtensionsTabPage() fixes these memory leaks.
Comment 2 SVN Robot 2014-04-07 23:53:56 UTC
"arielch" committed SVN revision 1585624 into trunk:
i124623 - Dispose extension's Options page to avoid memory leaks
Comment 3 Ariel Constenla-Haile 2014-04-07 23:59:55 UTC
Fixed with commit from comment 2.
Verified running AOO under valgrind.
Comment 4 Oliver Brinzing 2014-04-10 06:45:54 UTC
.