Kaydet (Commit) 642ae256 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

ChangedUIEventListener is refcounted, mustn't be helt by unique_ptr

Fixes c0ce1ec3 "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
üst dbcc169d
......@@ -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:
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment