[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sfx2/source
Michael Stahl
mstahl at redhat.com
Tue May 20 04:58:19 PDT 2014
sfx2/source/dialog/templdlg.cxx | 13 ++++++++++---
sfx2/source/inc/templdgi.hxx | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
New commits:
commit 2fd89dd60366caa64ed8b31b588e72dd639104bd
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon May 19 22:03:18 2014 +0200
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)
(cherry picked from commit 838c580fdba8b1c72bc854d101d302be0e3861d5)
Conflicts:
sfx2/source/dialog/templdlg.cxx
Change-Id: I1d9f0d82bf6d9f5da8f9bd2be57d01937d71fd26
Reviewed-on: https://gerrit.libreoffice.org/9406
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index cbd856f..11b430c 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -100,20 +100,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
@@ -124,6 +126,7 @@ public:
private:
SfxCommonTemplateDialog_Impl* m_pDialog;
+ DeletionWatcher *const m_pPrevious; /// let's add more epicycles!
};
// Re-direct functions
@@ -1015,9 +1018,13 @@ 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;
}
//-------------------------------------------------------------------------
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 0011aed..844acdb 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -111,7 +111,7 @@ private:
void ReadResource();
void ClearResource();
void impl_clear();
- void impl_setDeletionWatcher(DeletionWatcher* pNewWatcher);
+ DeletionWatcher * impl_setDeletionWatcher(DeletionWatcher* pNewWatcher);
protected:
#define MAX_FAMILIES 5
More information about the Libreoffice-commits
mailing list