[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Stephan Bergmann
sbergman at redhat.com
Mon Jun 26 08:01:51 UTC 2017
include/sfx2/notebookbar/NotebookbarTabControl.hxx | 6 ++++--
sfx2/source/notebookbar/NotebookbarTabControl.cxx | 3 +--
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 642ae256ea5b8083ba0b3c097ca8ea52304b9cdb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jun 26 09:57:54 2017 +0200
ChangedUIEventListener is refcounted, mustn't be helt by unique_ptr
Fixes c0ce1ec3736be861a2ed58827fadb25269ab0117 "loplugin:unusedfields in sfx2
part1" part on "fix a memory leak in NotebookbarTabControl where it was not
freeing it's m_pListener field", which now caused ASan to report heap-use-after-
free during CppunitTest_sw_dialogs_test.
Change-Id: Ic0209650692a34abd1ee451713615a03ed9c746f
diff --git a/include/sfx2/notebookbar/NotebookbarTabControl.hxx b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
index 9f6640dfe062..fa1b13cc10db 100644
--- a/include/sfx2/notebookbar/NotebookbarTabControl.hxx
+++ b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
@@ -13,9 +13,11 @@
#include <vcl/toolbox.hxx>
#include <sfx2/dllapi.h>
#include <vcl/tabctrl.hxx>
-#include <memory>
class ChangedUIEventListener;
+namespace com { namespace sun { namespace star { namespace ui {
+ class XUIConfigurationListener;
+} } } }
class SFX2_DLLPUBLIC NotebookbarTabControl : public NotebookbarTabControlBase
{
@@ -36,7 +38,7 @@ private:
);
DECL_LINK(OpenNotebookbarPopupMenu, NotebookBar*, void);
- std::unique_ptr<ChangedUIEventListener> m_pListener;
+ css::uno::Reference<css::ui::XUIConfigurationListener> m_pListener;
css::uno::Reference<css::frame::XFrame> m_xFrame;
protected:
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 9bf86aa6d505..fbff4b02661f 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -130,7 +130,6 @@ public:
NotebookbarTabControl::NotebookbarTabControl( Window* pParent )
: NotebookbarTabControlBase( pParent )
-, m_pListener( nullptr )
, m_bInitialized( false )
, m_bInvalidate( true )
{
@@ -150,7 +149,7 @@ void NotebookbarTabControl::StateChanged(StateChangedType nStateChange)
SetToolBox( static_cast<ToolBox*>( pShortcuts.get() ) );
SetIconClickHdl( LINK( this, NotebookbarTabControl, OpenNotebookbarPopupMenu ) );
- m_pListener.reset( new ChangedUIEventListener( this ) );
+ m_pListener = new ChangedUIEventListener( this );
m_bInitialized = true;
}
More information about the Libreoffice-commits
mailing list