[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sfx2/source

Caolán McNamara caolanm at redhat.com
Wed Apr 15 08:18:44 PDT 2015


 sfx2/source/appl/fileobj.cxx |   20 +++++++++++++-------
 sfx2/source/appl/fileobj.hxx |    4 +++-
 2 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 2baea0120f7436e37b6f2564ca88befda5da34a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 15 12:48:47 2015 +0100

    fix crash on re-export of fdo50057-2.odt to odt
    
    Change-Id: Ice7a754dd4f42b5cf62ae2038b63d893b8a92fd8
    (cherry picked from commit 66c9aec156d974b939b680dccbb27e18fb153a23)
    Reviewed-on: https://gerrit.libreoffice.org/15324
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index 8876145..88f1e05 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -47,7 +47,9 @@
 #define FILETYPE_OBJECT     3
 
 SvFileObject::SvFileObject()
-    : pOldParent(NULL)
+    : nPostUserEventId(0)
+    , pDelMed(NULL)
+    , pOldParent(NULL)
     , nType(FILETYPE_TEXT)
     , bLoadAgain(true)
     , bSynchron(false)
@@ -64,14 +66,16 @@ SvFileObject::SvFileObject()
 
 SvFileObject::~SvFileObject()
 {
-    if ( xMed.Is() )
+    if (xMed.Is())
     {
         xMed->SetDoneLink( Link() );
         xMed.Clear();
     }
+    if (nPostUserEventId)
+        Application::RemoveUserEvent(nPostUserEventId);
+    delete pDelMed;
 }
 
-
 bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData,
                                 const OUString & rMimeType,
                                 bool bGetSynchron )
@@ -482,10 +486,10 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG )
         if( pThis->xMed.Is() )
         {
             pThis->xMed->SetDoneLink( Link() );
-
-            Application::PostUserEvent(
+            pThis->pDelMed = new SfxMediumRef(pThis->xMed);
+            pThis->nPostUserEventId = Application::PostUserEvent(
                         STATIC_LINK( pThis, SvFileObject, DelMedium_Impl ),
-                        new SfxMediumRef( pThis->xMed ));
+                        pThis->pDelMed);
             pThis->xMed.Clear();
         }
     }
@@ -495,7 +499,9 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG )
 
 IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed )
 {
-    (void)pThis;
+    pThis->nPostUserEventId = 0;
+    assert(pThis->pDelMed == pDelMed);
+    pThis->pDelMed = NULL;
     delete pDelMed;
     return 0;
 }
diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx
index 78aa1fb..85fb53b 100644
--- a/sfx2/source/appl/fileobj.hxx
+++ b/sfx2/source/appl/fileobj.hxx
@@ -33,7 +33,9 @@ class SvFileObject : public sfx2::SvLinkSource
     OUString            sReferer;
     Link                aEndEditLink;
     SfxMediumRef        xMed;
-    vcl::Window*             pOldParent;
+    ImplSVEvent*        nPostUserEventId;
+    SfxMediumRef*       pDelMed;
+    vcl::Window*        pOldParent;
 
     sal_uInt8 nType;
 


More information about the Libreoffice-commits mailing list