From 8a6275b0b92d959f0b440a73362c7ec0eea4436e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 8 Oct 2014 12:57:00 +0200 Subject: Do not terminate desktop from a Timer kendy, as you recently changed Timer handling on Windows: debugging why quickstarter no longer works on Windows, I run into the phenomenon that IdleTerminate::Timeout (sfx2/source/appl/shutdownicon.cxx) executes on the main thread, and from within the m_xDesktop->terminate() call Timer::ImplDeInitTimer is called which deletes the pTimerData corresponding to our IldeTerminate, so that Timer::ImplTimerCallbackProc, after the return from IdleTerminate::Timeout, will operate on a stale pTimerData and crash; could that be related to those recent changes? sberg: I think mst told that we were previously never deleting the timer, and that he did some changes there [...] sberg, IdleTerminate needs a different implementation sberg, does it work to do this via PostUserEvent, as "Application::Quit()" does? mst__, do you think calling terminate from a Timer did work in the past? [...] sberg, perhaps it did before [a recent] commit but i would guess it would be more by accident than by design Change-Id: I23b14ba59a963cc2209a261a1459d532a88acdc0 (cherry picked from commit d8a0ecc94bfbfc1d9c8403f0e894d3b7e40384f2) Reviewed-on: https://gerrit.libreoffice.org/11852 Reviewed-by: Andras Timar Tested-by: Andras Timar --- sfx2/source/appl/shutdownicon.cxx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1ed8c9cb53e2..55e1c5eef3ab 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -63,7 +63,6 @@ #include #include #endif -#include #include @@ -183,22 +182,6 @@ bool LoadModule() } -class IdleTerminate : Timer -{ - ::com::sun::star::uno::Reference< XDesktop2 > m_xDesktop; -public: - IdleTerminate (::com::sun::star::uno::Reference< XDesktop2 > xDesktop) - { - m_xDesktop = xDesktop; - Start(); - } - virtual void Timeout() SAL_OVERRIDE - { - m_xDesktop->terminate(); - delete this; - } -}; - void ShutdownIcon::initSystray() { if (m_bInitialized) @@ -564,7 +547,7 @@ void ShutdownIcon::terminateDesktop() // terminate desktop only if no tasks exist ::com::sun::star::uno::Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY ); if( xTasks.is() && xTasks->getCount() < 1 ) - new IdleTerminate( xDesktop ); + Application::Quit(); // remove the instance pointer ShutdownIcon::pShutdownIcon = 0; -- cgit v1.2.3