diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-05-19 22:03:18 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-05-19 22:24:07 +0200 |
commit | 838c580fdba8b1c72bc854d101d302be0e3861d5 (patch) | |
tree | bf01c436c96807280c75fe0f825c327e8d90aad0 /sfx2 | |
parent | 2fc4f5cd750cc3899ffc6b2f831edcb01e7773b4 (diff) |
fdo#78536: sfx2: template dialog: make the am-i-dead-yet check reentrant
In the fine tradition of our enterprise-grade code base, this lets the
check in SfxCommonTemplateDialog_Impl::Execute_Impl() do an early
return if the "this" instance has signalled its untimely demise even if
there are multiple calls of Execute_Impl() on the stack; extending
the scheme with further epicycles to make it work if the Execute_Impl()
calls happen on 2 different threads is left as an exercise for the
interested reader.
(regression from bcc52fb2ebdf77a1cc089857775fd742085b45b6)
Change-Id: I1d9f0d82bf6d9f5da8f9bd2be57d01937d71fd26
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index fd6b5ef1aa90..e59e14f44781 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -101,20 +101,22 @@ class SfxCommonTemplateDialog_Impl::DeletionWatcher : private boost::noncopyable public: explicit DeletionWatcher(SfxCommonTemplateDialog_Impl& rDialog) : m_pDialog(&rDialog) + , m_pPrevious(m_pDialog->impl_setDeletionWatcher(this)) { - m_pDialog->impl_setDeletionWatcher(this); } ~DeletionWatcher() { if (m_pDialog) - m_pDialog->impl_setDeletionWatcher(0); + m_pDialog->impl_setDeletionWatcher(m_pPrevious); } // Signal that the dialog was deleted void signal() { m_pDialog = 0; + if (m_pPrevious) + m_pPrevious->signal(); } // Return true if the dialog was deleted @@ -125,6 +127,7 @@ public: private: SfxCommonTemplateDialog_Impl* m_pDialog; + DeletionWatcher *const m_pPrevious; /// let's add more epicycles! }; // Re-direct functions @@ -961,13 +964,16 @@ void SfxCommonTemplateDialog_Impl::impl_clear() DELETEZ( m_pStyleFamiliesId ); } -void SfxCommonTemplateDialog_Impl::impl_setDeletionWatcher(DeletionWatcher* pNewWatcher) +SfxCommonTemplateDialog_Impl::DeletionWatcher * +SfxCommonTemplateDialog_Impl::impl_setDeletionWatcher( + DeletionWatcher *const pNewWatcher) { + DeletionWatcher *const pRet(m_pDeletionWatcher); m_pDeletionWatcher = pNewWatcher; + return pRet; } - void SfxCommonTemplateDialog_Impl::Initialize() { // Read global user resource diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 3a3495338f8a..d313a6bc44ea 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -155,7 +155,7 @@ private: void ReadResource(); void ClearResource(); void impl_clear(); - void impl_setDeletionWatcher(DeletionWatcher* pNewWatcher); + DeletionWatcher * impl_setDeletionWatcher(DeletionWatcher* pNewWatcher); protected: #define MAX_FAMILIES 5 |