Kaydet (Commit) d8a0ecc9 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 62aa0f83
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#endif #endif
#include <vcl/timer.hxx>
#include <sfx2/sfxresid.hxx> #include <sfx2/sfxresid.hxx>
...@@ -183,22 +182,6 @@ bool LoadModule() ...@@ -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() void ShutdownIcon::initSystray()
{ {
if (m_bInitialized) if (m_bInitialized)
...@@ -564,7 +547,7 @@ void ShutdownIcon::terminateDesktop() ...@@ -564,7 +547,7 @@ void ShutdownIcon::terminateDesktop()
// terminate desktop only if no tasks exist // terminate desktop only if no tasks exist
::com::sun::star::uno::Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY ); ::com::sun::star::uno::Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY );
if( xTasks.is() && xTasks->getCount() < 1 ) if( xTasks.is() && xTasks->getCount() < 1 )
new IdleTerminate( xDesktop ); Application::Quit();
// remove the instance pointer // remove the instance pointer
ShutdownIcon::pShutdownIcon = 0; ShutdownIcon::pShutdownIcon = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment