diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-10-08 12:57:00 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-10-08 13:16:45 +0000 |
commit | 8a6275b0b92d959f0b440a73362c7ec0eea4436e (patch) | |
tree | 11e95332e836a7247ffa49530dd16a10d7cfe30a | |
parent | 658afeab6e956dc5093d25d734c22327aed3dc60 (diff) |
Do not terminate desktop from a Timer
<sberg> 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?
<kendy> sberg: I think mst told that we were previously never deleting the
timer, and that he did some changes there [...]
<mst__> sberg, IdleTerminate needs a different implementation
<mst__> sberg, does it work to do this via PostUserEvent, as
"Application::Quit()" does?
<sberg> mst__, do you think calling terminate from a Timer did work in the past?
[...]
<mst__> 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 <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 19 |
1 files changed, 1 insertions, 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 <unistd.h> #include <errno.h> #endif -#include <vcl/timer.hxx> #include <sfx2/sfxresid.hxx> @@ -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; |