Re: breaking yield loops on forced quit.
Something like this: https://gerrit.libreoffice.org/c/core/+/112409 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: breaking yield loops on forced quit.
Hi *, Am 12.03.21 um 12:16 schrieb Michael Meeks: 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. ... regression? 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. 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 (?) There is also: static void Quit(); static void EndYield(); so we can add bool Application::IsQuit() { return ImplGetSVData()->maAppData.mbAppQuit; } From my POV and your example, whatever IsPrinting is testing (I assume some thread or OS API), should return earlier / cancel processing / check IsQuit / imply called EndYield. I don't think trying to "beef up" Application::Yield in whatever direction will help, but might introduce other problems, like un-joined threads, missing cleanup and whatnot. Adding a !Application::IsQuit to a yield loop, might be the right fix in some cases, but not generally. Application::Quit already sets mbAppQuit and calls PostUserEvent to wake up yield. JMG ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
breaking yield loops on forced quit.
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.me...@collabora.com <><, GM Collabora Productivity Hangout: mejme...@gmail.com, Skype: mmeeks (M) +44 7795 666 147 - timezone usually UK / Europe ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice