Author: af
Date: Thu Mar 13 13:47:41 2014
New Revision: 1577162

URL: http://svn.apache.org/r1577162
Log:
124392: Avoid crash on close after assigning style. (merged from trunk)

Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
    openoffice/branches/AOO410/main/sfx2/inc/sfx2/templdlg.hxx
    openoffice/branches/AOO410/main/sfx2/source/dialog/templdlg.cxx
    openoffice/branches/AOO410/main/sfx2/source/inc/templdgi.hxx
    openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarChildWindow.cxx
    openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
    
openoffice/branches/AOO410/main/solenv/bin/modules/installer/windows/directory.pm

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1576748

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1576748

Modified: 
openoffice/branches/AOO410/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- 
openoffice/branches/AOO410/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx 
(original)
+++ 
openoffice/branches/AOO410/main/sfx2/inc/sfx2/sidebar/SidebarChildWindow.hxx 
Thu Mar 13 13:47:41 2014
@@ -42,6 +42,7 @@ public:
         sal_uInt16 nId,
         SfxBindings* pBindings,
         SfxChildWinInfo* pInfo);
+    virtual ~SidebarChildWindow (void);
 
     SFX_DECL_CHILDWINDOW(SidebarChildWindow);
 

Modified: openoffice/branches/AOO410/main/sfx2/inc/sfx2/templdlg.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/inc/sfx2/templdlg.hxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sfx2/inc/sfx2/templdlg.hxx (original)
+++ openoffice/branches/AOO410/main/sfx2/inc/sfx2/templdlg.hxx Thu Mar 13 
13:47:41 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/branches/AOO410/main/sfx2/source/dialog/templdlg.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/source/dialog/templdlg.cxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sfx2/source/dialog/templdlg.cxx (original)
+++ openoffice/branches/AOO410/main/sfx2/source/dialog/templdlg.cxx Thu Mar 13 
13:47:41 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/branches/AOO410/main/sfx2/source/inc/templdgi.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/source/inc/templdgi.hxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sfx2/source/inc/templdgi.hxx (original)
+++ openoffice/branches/AOO410/main/sfx2/source/inc/templdgi.hxx Thu Mar 13 
13:47:41 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/branches/AOO410/main/sfx2/source/sidebar/SidebarChildWindow.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarChildWindow.cxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarChildWindow.cxx 
(original)
+++ openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarChildWindow.cxx 
Thu Mar 13 13:47:41 2014
@@ -64,6 +64,13 @@ SidebarChildWindow::SidebarChildWindow (
 
 
 
+SidebarChildWindow::~SidebarChildWindow (void)
+{
+}
+
+
+
+
 sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
 {
     if (pWindow != NULL)

Modified: 
openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarDockingWindow.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarDockingWindow.cxx?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- 
openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarDockingWindow.cxx 
(original)
+++ 
openoffice/branches/AOO410/main/sfx2/source/sidebar/SidebarDockingWindow.cxx 
Thu Mar 13 13:47:41 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();
+    }
 }
 
 

Modified: 
openoffice/branches/AOO410/main/solenv/bin/modules/installer/windows/directory.pm
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/solenv/bin/modules/installer/windows/directory.pm?rev=1577162&r1=1577161&r2=1577162&view=diff
==============================================================================
--- 
openoffice/branches/AOO410/main/solenv/bin/modules/installer/windows/directory.pm
 (original)
+++ 
openoffice/branches/AOO410/main/solenv/bin/modules/installer/windows/directory.pm
 Thu Mar 13 13:47:41 2014
@@ -493,11 +493,19 @@ sub setup_global_font_directory_name ($)
 {
        my ($directories) = @_;
 
+    $installer::logger::Info->printf("setup_global_font_directory_name, 
checking %d entries\n",
+        scalar @$directories);
+    $installer::logger::Info->printf(" fontsdirhostname is %s\n",
+        $installer::globals::fontsdirhostname);
+    $installer::logger::Info->printf(" fontsdirname is %s\n",
+        $installer::globals::fontsdirname);
        foreach my $directory (@$directories)
        {               
         next unless defined $directory->{'Dir'};
         next unless defined $directory->{'defaultdir'};
 
+        $installer::logger::Info->printf("    Dir is %s\n", 
$directory->{'Dir'});
+        $installer::logger::Info->printf("    defaultdir is %s\n", 
$directory->{'defaultdir'});
         next if $directory->{'Dir'} ne "PREDEFINED_OSSYSTEMFONTDIR";
         next if $directory->{'defaultdir'} ne 
$installer::globals::fontsdirhostname;
 
@@ -512,6 +520,22 @@ sub setup_global_font_directory_name ($)
             $directory->{'HostName'});
         installer::scriptitems::print_script_item($directory);
        }
+       foreach my $onedir (@$directories)
+    {
+       my $fontdir = "";
+               if ( $onedir->{'Dir'} ) { $fontdir = $onedir->{'Dir'}; }
+
+               my $fontdefaultdir = "";
+               if ( $onedir->{'defaultdir'} ) { $fontdefaultdir = 
$onedir->{'defaultdir'}; }
+
+               if (( $fontdir eq "PREDEFINED_OSSYSTEMFONTDIR" ) && ( 
$fontdefaultdir eq $installer::globals::fontsdirhostname ))
+               {
+            $installer::logger::Info->printf("fontsdirname   = %s\n", 
$onedir->{'defaultdir'});
+            $installer::logger::Info->printf("              is %s\n", 
$installer::globals::fontsdirname);
+            $installer::logger::Info->printf("fontsdirparent = %s\n", 
$onedir->{'uniqueparentname'});
+            $installer::logger::Info->printf("              is %s\n", 
$installer::globals::fontsdirparent);
+               }
+    }
 }
 
 #####################################################
@@ -658,6 +682,9 @@ sub process_root_directories ($$)
     }
        &$functor($installer::globals::templatefolder, "TARGETDIR", 
$directorytableentry);
 
+    $installer::logger::Info->printf("process_root_directories: 
fontsdirname=%s, fontsfoldername=%s\n",
+        $installer::globals::fontsdirname,
+        $installer::globals::fontsfoldername);
        if ( $installer::globals::fontsdirname )
        {
                &$functor(


Reply via email to