[libreoffice/f21] Resolves: rhbz#1202138 fix crash on exit

Caolán McNamara caolanm at fedoraproject.org
Thu Mar 19 13:09:49 UTC 2015


commit b43c3597ca0dd884cefb7d0f370a79b7a72fe761
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 19 13:07:44 2015 +0000

    Resolves: rhbz#1202138 fix crash on exit

 ...o-not-try-to-create-a-sfxApplication-when.patch | 146 +++++++++++++++++++++
 libreoffice.spec                                   |   6 +-
 2 files changed, 151 insertions(+), 1 deletion(-)
---
diff --git a/0001-fdo-69036-do-not-try-to-create-a-sfxApplication-when.patch b/0001-fdo-69036-do-not-try-to-create-a-sfxApplication-when.patch
new file mode 100644
index 0000000..ba39522
--- /dev/null
+++ b/0001-fdo-69036-do-not-try-to-create-a-sfxApplication-when.patch
@@ -0,0 +1,146 @@
+From 01a882039ec4d0edf4da7d3e10ffea569a3e4aee Mon Sep 17 00:00:00 2001
+From: Norbert Thiebaud <nthiebaud at gmail.com>
+Date: Fri, 27 Jun 2014 10:29:46 +0200
+Subject: [PATCH] fdo#69036 do not try to create a sfxApplication when we are
+ tearing-down
+
+This was triggered by connectivity calc driver, which on shutdown
+was trying to 'dispose()' it's connection
+which in turn would, if the shutdown of calc was already done
+try to re-create an sfxApplication instance, just to delete
+illusory inexistant documents...
+
+Change-Id: Ic166367ca399d613743f379ebbfbffb5813701c0
+---
+ include/sfx2/app.hxx        |  2 +-
+ sfx2/source/doc/objxtor.cxx | 35 ++++++++++++++++++++---------------
+ 2 files changed, 21 insertions(+), 16 deletions(-)
+
+diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
+index 1c67756..0928635 100644
+--- a/include/sfx2/app.hxx
++++ b/include/sfx2/app.hxx
+@@ -149,6 +149,7 @@ public:
+                                 SfxApplication();
+                                 virtual ~SfxApplication();
+     static SfxApplication*      GetOrCreate();
++    static SfxApplication*      Get() { return pApp;}
+ 
+     // Resource Manager
+     ResMgr*                     GetSfxResManager();
+@@ -202,7 +203,6 @@ public:
+     bool                        IsDowning() const;
+     void                        ResetLastDir();
+ 
+-    SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;}
+     SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl();
+     SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl();
+ 
+diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
+index 9ce512b..a374578 100644
+--- a/sfx2/source/doc/objxtor.cxx
++++ b/sfx2/source/doc/objxtor.cxx
+@@ -462,12 +462,17 @@ bool SfxObjectShell::Close()
+         if ( pImp->bClosing )
+         {
+             // remove from Document list
+-            SfxApplication *pSfxApp = SfxGetpApp();
+-            SfxObjectShellArr_Impl &rDocs = pSfxApp->GetObjectShells_Impl();
+-            SfxObjectShellArr_Impl::iterator it = std::find( rDocs.begin(), rDocs.end(), this );
+-            if ( it != rDocs.end() )
+-                rDocs.erase( it );
+-            pImp->bInList = false;
++            // If there is no App, there is no document to remove
++            // no need to call GetOrCreate here
++            SfxApplication *pSfxApp = SfxApplication::Get();
++            if(pSfxApp)
++            {
++                SfxObjectShellArr_Impl &rDocs = pSfxApp->GetObjectShells_Impl();
++                SfxObjectShellArr_Impl::iterator it = std::find( rDocs.begin(), rDocs.end(), this );
++                if ( it != rDocs.end() )
++                    rDocs.erase( it );
++                pImp->bInList = false;
++            }
+         }
+     }
+ 
+@@ -501,7 +506,7 @@ SfxObjectShell* SfxObjectShell::GetFirst
+     bool          bOnlyVisible
+ )
+ {
+-    SfxObjectShellArr_Impl &rDocs = SFX_APP()->GetObjectShells_Impl();
++    SfxObjectShellArr_Impl &rDocs = SfxGetpApp()->GetObjectShells_Impl();
+ 
+     // seach for a SfxDocument of the specified type
+     for ( sal_uInt16 nPos = 0; nPos < rDocs.size(); ++nPos )
+@@ -528,7 +533,7 @@ SfxObjectShell* SfxObjectShell::GetNext
+     bool                    bOnlyVisible
+ )
+ {
+-    SfxObjectShellArr_Impl &rDocs = SFX_APP()->GetObjectShells_Impl();
++    SfxObjectShellArr_Impl &rDocs = SfxGetpApp()->GetObjectShells_Impl();
+ 
+     // refind the specified predecessor
+     sal_uInt16 nPos;
+@@ -607,7 +612,7 @@ bool SfxObjectShell::PrepareClose
+         }
+     }
+ 
+-    SfxApplication *pSfxApp = SFX_APP();
++    SfxApplication *pSfxApp = SfxGetpApp();
+     pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(STR_EVENT_PREPARECLOSEDOC), this) );
+ 
+     if( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+@@ -712,7 +717,7 @@ BasicManager* SfxObjectShell::GetBasicManager() const
+     {
+         pBasMgr = lcl_getBasicManagerForDocument( *this );
+         if ( !pBasMgr )
+-            pBasMgr = SFX_APP()->GetBasicManager();
++            pBasMgr = SfxGetpApp()->GetBasicManager();
+     }
+     catch (const css::ucb::ContentCreationException& e)
+     {
+@@ -793,7 +798,7 @@ Reference< XLibraryContainer > SfxObjectShell::GetDialogContainer()
+ 
+     SAL_WARN("sfx.doc", "SfxObjectShell::GetDialogContainer: falling back to the application - is this really expected here?");
+ #endif
+-    return SFX_APP()->GetDialogContainer();
++    return SfxGetpApp()->GetDialogContainer();
+ }
+ 
+ Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer()
+@@ -814,7 +819,7 @@ Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer()
+     }
+     SAL_WARN("sfx.doc", "SfxObjectShell::GetBasicContainer: falling back to the application - is this really expected here?");
+ #endif
+-    return SFX_APP()->GetBasicContainer();
++    return SfxGetpApp()->GetBasicContainer();
+ }
+ 
+ StarBASIC* SfxObjectShell::GetBasic() const
+@@ -961,7 +966,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
+     // but we should have filtered quite some unnecessary calls already.
+ 
+ #ifndef DISABLE_SCRIPTING
+-    BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
++    BasicManager* pAppMgr = SfxGetpApp()->GetBasicManager();
+     rTheCurrentComponent = _rxComponent;
+     if ( pAppMgr )
+     {
+@@ -1156,11 +1161,11 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew )
+     if ( i_fromInitNew )
+     {
+         SetActivateEvent_Impl( SFX_EVENT_CREATEDOC );
+-        SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) );
++        SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) );
+     }
+     else
+     {
+-        SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) );
++        SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) );
+     }
+ }
+ 
+-- 
+2.1.0
+
diff --git a/libreoffice.spec b/libreoffice.spec
index d2ee4c9..aef670f 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -46,7 +46,7 @@ Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Epoch:          1
 Version:        %{libo_version}.2
-Release:        3%{?libo_prerelease}%{?dist}
+Release:        4%{?libo_prerelease}%{?dist}
 License:        (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0
 Group:          Applications/Productivity
 URL:            http://www.libreoffice.org/
@@ -372,6 +372,7 @@ Patch74: 0001-Resolves-rhbz-1193971-clear-hard-coded-char-props-in.patch
 Patch75: 0001-add-accel.-to-switch-monitors-to-pres.-console.patch
 Patch76: 0001-build-libetonyek-with-no-strict-aliasing.patch
 Patch77: 0002-propagate-user-set-CFLAGS-to-build.patch
+Patch78: 0001-fdo-69036-do-not-try-to-create-a-sfxApplication-when.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/libreoffice
@@ -2352,6 +2353,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Thu Mar 19 2015 Caolán McNamara <caolanm at redhat.com> - 1:4.3.6.2-4
+- Resolves: rhbz#1202138 fix crash on exit
+
 * Wed Feb 18 2015 Caolán McNamara <caolanm at redhat.com> - 1:4.3.6.2-3
 - Resolves: rhbz#1193971 clear hard coded char props in cells
 


More information about the scm-commits mailing list