[Libreoffice-commits] core.git: sfx2/source

Michael Stahl mstahl at redhat.com
Thu Mar 6 06:01:10 PST 2014


 sfx2/source/appl/appinit.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 2e29a518b04250b5f9cc9d0d77da3df076834d60
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Mar 6 13:43:21 2014 +0100

    sfx2: ensure that no timers are running after SfxApplication dies
    
    Timers may access global data that's tied to SfxApplication, and that
    seems difficult to fix or prevent; the SfxApplication is deleted
    before the main thread gets around to handling the PostUserEvent
    sent by Application::Quit().
    
    log from xmloff_unoapi:
    
    ==32095== Invalid read of size 8
    ==32095==    at 0x934D245: Font::Font(Font const&) (font.cxx:239)
    ==32095==    by 0x1FCEABDF: ImpEditEngine::FormatDoc() (impedit3.cxx:381)
    [...]
    ==32095==    by 0x1ED0F894: SdDrawDocument::LinkStubOnlineSpellingHdl(void*, void*) (drawdoc4.cxx:826)
    ==32095==    by 0x911FECD: Link::Call(void*) const (link.hxx:123)
    ==32095==    by 0x914F700: Timer::Timeout() (timer.cxx:224)
    ==32095==    by 0x914F394: Timer::ImplTimerCallbackProc() (timer.cxx:121)
    ==32095==    by 0x170B350A: SalTimer::CallCallback() (saltimer.hxx:53)
    ==32095==    by 0x170B26C6: SvpSalInstance::CheckTimeout(bool) (svpinst.cxx:188)
    ==32095==    by 0x170B2D25: SvpSalInstance::Yield(bool, bool) (svpinst.cxx:317)
    ==32095==    by 0x91460DF: ImplYield(bool, bool) (svapp.cxx:363)
    ==32095==    by 0x9142814: Application::Yield() (svapp.cxx:395)
    ==32095==    by 0x91427C2: Application::Execute() (svapp.cxx:344)
    ==32095==    by 0x4EC7589: desktop::Desktop::Main() (app.cxx:1680)
    ==32095==  Address 0x1d498b28 is 408 bytes inside a block of size 520 free'd
    ==32095==    at 0x4A078DE: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==32095==    by 0x954CFE5: VirtualDevice::~VirtualDevice() (virdev.cxx:202)
    ==32095==    by 0x1EE26F7D: SdModule::~SdModule() (sdmod.cxx:128)
    ==32095==    by 0x1EE26FFD: SdModule::~SdModule() (sdmod.cxx:129)
    ==32095==    by 0x65C9E47: SfxModule::DestroyModules_Impl() (module.cxx:327)
    ==32095==    by 0x654116A: SfxApplication::~SfxApplication() (app.cxx:226)
    ==32095==    by 0x6541249: SfxApplication::~SfxApplication() (app.cxx:244)
    ==32095==    by 0x655E452: SfxTerminateListener_Impl::notifyTermination(com::sun::star::lang::EventObject const&) (appinit.cxx:121)
    ==32095==    by 0x1B8A67A1: framework::Desktop::terminate() (desktop.cxx:343)
    
    Change-Id: Ib70444c2b0fc60daa094323510d20b146a416087

diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 3d9a8c3..5cbf85c 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -45,6 +45,7 @@
 #include <cppuhelper/supportsservice.hxx>
 
 #include <vcl/edit.hxx>
+#include <vcl/timer.hxx>
 
 #include <sfx2/unoctitm.hxx>
 #include "app.hrc"
@@ -106,6 +107,10 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
     SolarMutexGuard aGuard;
     utl::ConfigManager::storeConfigItems();
 
+    // Timers may access the SfxApplication and are only deleted in
+    // Application::Quit(), which is asynchronous (PostUserEvent) - disable!
+    Timer::ImplDeInitTimer();
+
     SfxApplication* pApp = SFX_APP();
     pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) );
     pApp->Get_Impl()->pAppDispatch->ReleaseAll();


More information about the Libreoffice-commits mailing list