You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2014/03/12 15:21:28 UTC

svn commit: r1576748 - in /openoffice/trunk/main/sfx2: inc/sfx2/sidebar/SidebarChildWindow.hxx inc/sfx2/templdlg.hxx source/dialog/templdlg.cxx source/inc/templdgi.hxx source/sidebar/SidebarChildWindow.cxx source/sidebar/SidebarDockingWindow.cxx

Author: af
Date: Wed Mar 12 14:21:27 2014
New Revision: 1576748

URL: http://svn.apache.org/r1576748
Log:
124392: Avoid crash on close after assigning style.

Modified:
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
    openoffice/trunk/main/sfx2/inc/sfx2/templdlg.hxx
    openoffice/trunk/main/sfx2/source/dialog/templdlg.cxx
    openoffice/trunk/main/sfx2/source/inc/templdgi.hxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarChildWindow.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarDockingWindow.cxx

Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx Wed Mar 12 14:21:27 2014
@@ -42,6 +42,7 @@ public:
         sal_uInt16 nId,
         SfxBindings* pBindings,
         SfxChildWinInfo* pInfo);
+    virtual ~SidebarChildWindow (void);
 
     SFX_DECL_CHILDWINDOW(SidebarChildWindow);
 

Modified: openoffice/trunk/main/sfx2/inc/sfx2/templdlg.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/templdlg.hxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/templdlg.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/templdlg.hxx Wed Mar 12 14:21:27 2014
@@ -100,7 +100,7 @@ class SFX2_DLLPUBLIC SfxTemplatePanelCon
 {
 public:
     SfxTemplatePanelControl (SfxBindings* pBindings, Window* pParentWindow);
-	~SfxTemplatePanelControl (void);
+	virtual ~SfxTemplatePanelControl (void);
 
     virtual void                Update();
     virtual void                DataChanged( const DataChangedEvent& _rDCEvt );

Modified: openoffice/trunk/main/sfx2/source/dialog/templdlg.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/dialog/templdlg.cxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/dialog/templdlg.cxx (original)
+++ openoffice/trunk/main/sfx2/source/dialog/templdlg.cxx Wed Mar 12 14:21:27 2014
@@ -1849,16 +1849,36 @@ sal_Bool SfxCommonTemplateDialog_Impl::E
 
 	pItems[ nCount++ ] = 0;
 
+    // This unbelievably crude technique is used to detect and handle
+    // destruction of this during the synchronous slot call: store a
+    // pointer to a local bool, initialize it to false and set that it
+    // to true in the destructor.
     Deleted aDeleted;
     pbDeleted = &aDeleted;
+
 	sal_uInt16 nModi = pModifier ? *pModifier : 0;
     const SfxPoolItem* pItem = rDispatcher.Execute(
 		nId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL,
 		pItems, nModi );
 
     // FIXME: Dialog can be destroyed while in Execute() check stack variable for dtor flag!
-    if ( !pItem || aDeleted() )
+    if (aDeleted())
+    {
+        // this has been deleted in the previous synchronous slot
+        // call.  Exit without touching anything.
         return sal_False;
+    }
+    else
+    {
+        // this has not been deleted.  Reset pbDeleted to prevent the
+        // destructor to access the local bool at a later and rather
+        // inconvenient time.  See bugs 124392 and 100110 for more information.
+        pbDeleted = NULL;
+    }
+    if (pItem == NULL)
+    {
+        return sal_False;
+    }
 
 	if ( nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId )
 	{
@@ -1880,10 +1900,6 @@ sal_Bool SfxCommonTemplateDialog_Impl::E
 		}
 	}
     
-    // Reset destroyed flag otherwise we use the pointer in the dtor
-    // where the local stack object is already destroyed. This would
-    // overwrite objects on the stack!! See #i100110
-    pbDeleted = NULL;
     return sal_True;
 }
 

Modified: openoffice/trunk/main/sfx2/source/inc/templdgi.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/inc/templdgi.hxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/inc/templdgi.hxx (original)
+++ openoffice/trunk/main/sfx2/source/inc/templdgi.hxx Wed Mar 12 14:21:27 2014
@@ -243,7 +243,7 @@ public:
 
 	SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window*, bool );
 	SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* );
-	~SfxCommonTemplateDialog_Impl();
+	virtual ~SfxCommonTemplateDialog_Impl();
 
 	DECL_LINK( MenuSelectHdl, Menu * );
 

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarChildWindow.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarChildWindow.cxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarChildWindow.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarChildWindow.cxx Wed Mar 12 14:21:27 2014
@@ -64,6 +64,13 @@ SidebarChildWindow::SidebarChildWindow (
 
 
 
+SidebarChildWindow::~SidebarChildWindow (void)
+{
+}
+
+
+
+
 sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
 {
     if (pWindow != NULL)

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarDockingWindow.cxx?rev=1576748&r1=1576747&r2=1576748&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarDockingWindow.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarDockingWindow.cxx Wed Mar 12 14:21:27 2014
@@ -71,6 +71,12 @@ SidebarDockingWindow::~SidebarDockingWin
 
 void SidebarDockingWindow::DoDispose (void)
 {
+    Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpSidebarController.get()), UNO_QUERY);
+    mpSidebarController.clear();
+    if (xComponent.is())
+    {
+        xComponent->dispose();
+    }
 }