breaking yield loops on forced quit.
Michael Meeks
michael.meeks at collabora.com
Fri Mar 12 11:16:12 UTC 2021
Hi Noel,
We've recently had problems with dialogs running in Online Kit
processes that are not cleaning up properly when the process is asked
to quit by the core.
The proximate fix is/was to hard kill the remote process =)
but - I'd love to do better if possible.
If you see vcl's:
Dialog::Execute () ...
// Yield util EndDialog is called or dialog gets destroyed
// (the latter should not happen, but better safe than sorry
while ( !xWindow->IsDisposed() && mbInExecute )
Application::Yield();
You see one of these:
while (condition)
Application::Yield();
archetypes. Of which there a dozen+ scattered around the code eg.
sfx2/source/doc/printhelper.cxx- while( m_pPrinter->IsPrinting() )
sfx2/source/doc/printhelper.cxx: Application::Yield();
etc. etc.
We really want to forcibly exit these loops when we have our
VCL quit flag set cf.
vcl/headless/svpinst.cxx- // External poll.
vcl/headless/svpinst.cxx- if (pSVData->mpPollClosure != nullptr &&
vcl/headless/svpinst.cxx: pSVData->mpPollCallback(pSVData->mpPollClosure, nTimeoutMicroS) < 0)
vcl/headless/svpinst.cxx- pSVData->maAppData.mbAppQuit = true;
Not least because Application:Yield becomes an instant-return when
we're trying to quit. So - we could add a flag:
while (condition && !(new Application::mbAppQuit accessor))
to all suspicious looking call-sites.
Perhaps it'd be nicer to have a:
Application::YieldWhile([]{ return m_pPrinter->IsPrinting(); });
or somesuch - so we can add that this just once (?)
Thoughts appreciated =)
Michael.
--
michael.meeks at collabora.com <><, GM Collabora Productivity
Hangout: mejmeeks at gmail.com, Skype: mmeeks
(M) +44 7795 666 147 - timezone usually UK / Europe
More information about the LibreOffice
mailing list