Kaydet (Commit) 653394fb authored tarafından Caolán McNamara's avatar Caolán McNamara

turn SfxPickList singleton a member of SfxApplication

SfxPickList listens to the SfxApplication so it can
be made a member of that, and drop the singleton, which
is causing trouble like...

 #0  0x00007ffff613ad7d in ImplDbgTestSolarMutex() () at /libreoffice/symbols/vcl/source/app/dbggui.cxx:47
 #1  0x00007ffff6ee86e1 in SfxBroadcaster::RemoveListener(SfxListener&) (this=0x5555565d0380, rListener=...) at /libreoffice/symbols/svl/source/notify/SfxBroadcaster.cxx:126
 #2  0x00007ffff6eea993 in SfxListener::~SfxListener() (this=0x555556622620, __in_chrg=<optimized out>) at /libreoffice/symbols/svl/source/notify/lstner.cxx:66
 #3  0x00007ffff7207b45 in SfxPickListImpl::~SfxPickListImpl() (this=0x555556622620, __in_chrg=<optimized out>) at /libreoffice/symbols/sfx2/source/appl/sfxpicklist.cxx:84
 #4  0x00007ffff7207b45 in SfxPickListImpl::~SfxPickListImpl() (this=0x555556622620, __in_chrg=<optimized out>) at /libreoffice/symbols/sfx2/source/appl/sfxpicklist.cxx:84
 #5  0x00007ffff7206aa5 in std::default_delete<SfxPickListImpl>::operator()(SfxPickListImpl*) const (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/7/bits/unique_ptr.h:78
 #6  0x00007ffff7206aa5 in std::unique_ptr<SfxPickListImpl, std::default_delete<SfxPickListImpl> >::reset(SfxPickListImpl*) (__p=<optimized out>, this=0x7ffff76775a8 <SfxPickList::ensure()::aUniqueInstance>) at /usr/include/c++/7/bits/unique_ptr.h:376
 #7  0x00007ffff7206aa5 in SfxPickList::~SfxPickList() (this=0x7ffff76775a8 <SfxPickList::ensure()::aUniqueInstance>, __in_chrg=<optimized out>) at /libreoffice/symbols/sfx2/source/appl/sfxpicklist.cxx:188
 #8  0x00007ffff44dc041 in __run_exit_handlers (status=0, listp=0x7ffff4884718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
 #9  0x00007ffff44dc13a in __GI_exit (status=<optimized out>) at exit.c:139
 #10 0x00007ffff44bab9e in __libc_start_main (main=0x555555557880 <main(int, char**)>, argc=10, argv=0x7fffffffdde8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffddd8) at ../csu/libc-start.c:344
 #11 0x00005555555578da in _start ()

Change-Id: Ic781f3eb065fef14da1f10a56246b9b7068e1529
c781f3eb065fef14da1f10a56246b9b7068e1529
Reviewed-on: https://gerrit.libreoffice.org/58494
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 1cb3195f
......@@ -30,6 +30,7 @@
#include <appdata.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/event.hxx>
#include <sfxpicklist.hxx>
#include <sfxtypes.hxx>
#include <sfx2/doctempl.hxx>
#include <arrdecl.hxx>
......
......@@ -218,7 +218,7 @@ void SfxApplication::Initialize_Impl()
SolarMutexGuard aGuard;
//ensure instantiation of listener that manages the internal recently-used
//list
SfxPickList::ensure();
pImpl->mxAppPickList.reset(new SfxPickList(*this));
}
DBG_ASSERT( !pImpl->pAppDispat, "AppDispatcher already exists" );
......
......@@ -78,7 +78,7 @@ class SfxPickListImpl : public SfxListener
static void AddDocumentToPickList( SfxObjectShell* pDocShell );
public:
SfxPickListImpl();
SfxPickListImpl(SfxApplication& rApp);
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
};
......@@ -161,25 +161,18 @@ void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh )
pFilter ? pFilter->GetServiceName() : OUString() );
}
SfxPickList::SfxPickList()
: mxImpl(new SfxPickListImpl())
SfxPickList::SfxPickList(SfxApplication& rApp)
: mxImpl(new SfxPickListImpl(rApp))
{
}
SfxPickList::~SfxPickList()
{
std::unique_ptr<SolarMutexGuard> xGuard(comphelper::SolarMutex::get() ? new SolarMutexGuard : nullptr);
mxImpl.reset();
}
void SfxPickList::ensure()
SfxPickListImpl::SfxPickListImpl(SfxApplication& rApp)
{
static SfxPickList aUniqueInstance;
}
SfxPickListImpl::SfxPickListImpl()
{
StartListening( *SfxGetpApp() );
StartListening(rApp);
}
void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
......
......@@ -35,6 +35,7 @@
#include <vector>
class SfxApplication;
class SfxPickList;
class SfxProgress;
class SfxDdeDocTopic_Impl;
class DdeService;
......@@ -88,6 +89,7 @@ public:
SfxErrorHandler *m_pSbxErrorHdl;
#endif
rtl::Reference<SfxStatusDispatcher> mxAppDispatch;
std::unique_ptr<SfxPickList> mxAppPickList;
SfxDocumentTemplates* pTemplates;
// global pointers
......
......@@ -20,14 +20,11 @@
#ifndef INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX
#define INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX
#include <vcl/menu.hxx>
#include <svl/lstner.hxx>
#include <com/sun/star/util/XStringWidth.hpp>
#include <vector>
#include <memory>
#define PICKLIST_MAXSIZE 100
class SfxApplication;
class SfxPickListImpl;
class SfxPickList
......@@ -35,9 +32,7 @@ class SfxPickList
private:
std::unique_ptr<SfxPickListImpl> mxImpl;
public:
SfxPickList();
/// Ensure instantiation of listener that manages the internal recently-used list
static void ensure();
SfxPickList(SfxApplication& rApp);
~SfxPickList();
};
......
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