diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-02 17:16:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-02 22:16:46 +0200 |
commit | 653394fb199fae2d9e39f681fc72ffffb35fe7f3 (patch) | |
tree | 82e5e5a3a387502c4118a895c4084f543901934f | |
parent | 1cb3195fa7859618736002dedc3bd0ff7e164c35 (diff) |
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: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sfx2/source/appl/appdata.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/appinit.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/sfxpicklist.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/inc/appdata.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/sfxpicklist.hxx | 11 |
5 files changed, 12 insertions, 21 deletions
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index cf12b4cc1e20..fa3413c95ced 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -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> diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 3771047e805e..c2a91d51283d 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -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" ); diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index e95daa5a82cf..451afe95cf8a 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -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 ) diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 8dffcb348d01..aa3bed3e121d 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -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 diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx index bce382461c7d..6a6e818a613b 100644 --- a/sfx2/source/inc/sfxpicklist.hxx +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -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(); }; |