[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - fpicker/source include/vcl vcl/source
fpicker/source/win32/asyncrequests.cxx |5 + include/vcl/winscheduler.hxx |5 + vcl/source/app/winscheduler.cxx| 12 +--- 3 files changed, 19 insertions(+), 3 deletions(-) New commits: commit 7420a6175358fdc1cda133c0ed2eab693cc72e54 Author: Mike Kaganski AuthorDate: Sat Apr 6 17:04:06 2019 +0100 Commit: Caolán McNamara CommitDate: Tue Apr 9 09:59:03 2019 +0200 tdf#124579: ensure to provide an event to wake up main loop when notifying Without that, Request::waitProcessMessages might wait indefinitely for Application::Yield() to return; while the latter would wait for a message in GetMessage. If there's no visible LO window, the message might never arrive by itself. Co-authored-by: Jan-Marek Glogowski Change-Id: Ie2622053a8d4467eb1cbd579d8496cb5ddef08aa Reviewed-on: https://gerrit.libreoffice.org/70346 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit e3d737119fc7bdce224a173896486f376f95a417) Reviewed-on: https://gerrit.libreoffice.org/70349 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/fpicker/source/win32/asyncrequests.cxx b/fpicker/source/win32/asyncrequests.cxx index 5a5b1decf180..fcd7eadc3010 100644 --- a/fpicker/source/win32/asyncrequests.cxx +++ b/fpicker/source/win32/asyncrequests.cxx @@ -19,6 +19,7 @@ #include "asyncrequests.hxx" #include +#include #include namespace fpicker{ @@ -56,6 +57,10 @@ void Request::waitProcessMessages() void Request::notify() { m_aJoiner.set(); +// Make sure that main loop receives at least this message to return from GetMessage and recheck +// the condition, even in case when there's no visible application windows present, and thus no +// other messages might arrive to the main loop. +WinScheduler::PostDummyMessage(); } AsyncRequests::AsyncRequests(const RequestHandlerRef& rHandler) diff --git a/include/vcl/winscheduler.hxx b/include/vcl/winscheduler.hxx index 02d86116bb38..6f77f3a7b082 100644 --- a/include/vcl/winscheduler.hxx +++ b/include/vcl/winscheduler.hxx @@ -31,6 +31,11 @@ struct VCL_DLLPUBLIC WinScheduler final /// Hack for Windows native dialogs, which run the main loop, so we can't /// use the direct processing shortcut. static void SetForceRealTimer(); + +// Posting a dummy messages might be needed to ensure that main loop eventually returns from +// GetMessage ("wakes up") in modes without a visible window. This, e.g., might be needed to +// let main thread recheck a condition set from another thread. +static void PostDummyMessage(); }; #endif // _WIN32 diff --git a/vcl/source/app/winscheduler.cxx b/vcl/source/app/winscheduler.cxx index f8a90f3f638d..8ec11211cfe0 100644 --- a/vcl/source/app/winscheduler.cxx +++ b/vcl/source/app/winscheduler.cxx @@ -25,12 +25,18 @@ #include #include -void WinScheduler::SetForceRealTimer() +namespace { -BOOL const ret -= PostMessageW(GetSalData()->mpInstance->mhComWnd, SAL_MSG_FORCE_REAL_TIMER, 0, 0); +void PostMessageToComWnd(UINT nMsg) +{ +BOOL const ret = PostMessageW(GetSalData()->mpInstance->mhComWnd, nMsg, 0, 0); SAL_WARN_IF(0 == ret, "vcl.schedule", "ERROR: PostMessage() failed!"); } +} + +void WinScheduler::SetForceRealTimer() { PostMessageToComWnd(SAL_MSG_FORCE_REAL_TIMER); } + +void WinScheduler::PostDummyMessage() { PostMessageToComWnd(SAL_MSG_DUMMY); } #endif // _WIN32 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - fpicker/source
fpicker/source/win32/asyncrequests.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit e59e4c41e0fd9beaa03a60def58feefdef1e0bb6 Author: Mike Kaganski AuthorDate: Fri Apr 5 15:24:31 2019 +0300 Commit: Michael Weghorn CommitDate: Fri Apr 5 23:14:03 2019 +0200 tdf#123502: Make sure to hold the mutex before releasing it Fixes a regression after commit 5b2f1243bd44b450da26c8344b3ee459f8e88f6c The destruction of the dialog is initiated by a callback executed from VCLXButton::ProcessWindowEvent, which notifies listeners, using a call to VCLXWindow::ImplExecuteAsyncWithoutSolarLock. The stack looks like this: ucrtbased.dll!issue_debug_notification(const wchar_t * const message) Line 28 at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(28) ucrtbased.dll!__acrt_report_runtime_error(const wchar_t * message) Line 154 at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(154) ucrtbased.dll!abort() Line 51 at minkernel\crts\ucrt\src\appcrt\startup\abort.cpp(51) comphelper.dll!comphelper::SolarMutex::doRelease(bool bUnlockAll) Line 65 at c:\lo\src\core2\comphelper\source\misc\solarmutex.cxx(65) vclplug_winlo.dll!SalYieldMutex::doRelease(bool bUnlockAll) Line 169 at c:\lo\src\core2\vcl\win\app\salinst.cxx(169) comphelper.dll!comphelper::SolarMutex::release(bool bUnlockAll) Line 89 at c:\lo\src\core2\include\comphelper\solarmutex.hxx(89) vcllo.dll!SalInstance::ReleaseYieldMutexAll() Line 114 at c:\lo\src\core2\vcl\source\app\salvtables.cxx(114) vcllo.dll!Application::ReleaseSolarMutex() Line 548 at c:\lo\src\core2\vcl\source\app\svapp.cxx(548) fps.dll!SolarMutexReleaser::SolarMutexReleaser() Line 1479 at c:\lo\src\core2\include\vcl\svapp.hxx(1479) fps.dll!fpicker::win32::vista::AsyncRequests::~AsyncRequests() Line 84 at c:\lo\src\core2\fpicker\source\win32\asyncrequests.cxx(84) fps.dll!fpicker::win32::vista::VistaFilePicker::~VistaFilePicker() Line 72 at c:\lo\src\core2\fpicker\source\win32\vistafilepicker.cxx(72) fps.dll!fpicker::win32::vista::VistaFilePicker::`scalar deleting destructor'(unsigned int) cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 at c:\lo\src\core2\cppuhelper\source\weak.cxx(233) cppuhelper3MSC.dll!cppu::WeakComponentImplHelperBase::release() Line 84 at c:\lo\src\core2\cppuhelper\source\implbase.cxx(84) fps.dll!cppu::PartialWeakComponentImplHelper::release() Line 86 at c:\lo\src\core2\include\cppuhelper\compbase.hxx(86) invocationlo.dll!com::sun::star::uno::cpp_release(void * pCppI) Line 48 at c:\lo\src\core2\include\com\sun\star\uno\genfunc.hxx(48) cppu3.dll!cppu::_release(void * p, void(*)(void *) release) Line 86 at c:\lo\src\core2\cppu\source\uno\prim.hxx(86) cppu3.dll!cppu::_destructAny(_uno_Any * pAny, void(*)(void *) release) Line 130 at c:\lo\src\core2\cppu\source\uno\destr.hxx(130) cppu3.dll!uno_any_destruct(_uno_Any * pValue, void(*)(void *) release) Line 131 at c:\lo\src\core2\cppu\source\uno\any.cxx(131) invocationlo.dll!com::sun::star::uno::Any::~Any() Line 111 at c:\lo\src\core2\include\com\sun\star\uno\any.hxx(111) invocationlo.dll!stoc_inv::Invocation_Impl::~Invocation_Impl() invocationlo.dll!stoc_inv::Invocation_Impl::`scalar deleting destructor'(unsigned int) cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 at c:\lo\src\core2\cppuhelper\source\weak.cxx(233) invocationlo.dll!stoc_inv::Invocation_Impl::release() Line 110 at c:\lo\src\core2\stoc\source\invocation\invocation.cxx(110) pyuno_d.pyd!com::sun::star::uno::Reference::~Reference() Line 110 at c:\lo\src\core2\include\com\sun\star\uno\reference.hxx(110) pyuno_d.pyd!pyuno::PyUNOInternals::~PyUNOInternals() pyuno_d.pyd!pyuno::PyUNOInternals::`scalar deleting destructor'(unsigned int) pyuno_d.pyd!pyuno::PyUNO_del(_object * self) Line 81 at c:\lo\src\core2\pyuno\source\module\pyuno.cxx(81) python35_d.dll!_Py_Dealloc(_object * op) Line 1795 at c:\lo\src\core2\workdir\unpackedtarball\python3\objects\object.c(1795) python35_d.dll!dict_dealloc(PyDictObject * mp) Line 1646 at c:\lo\src\core2\workdir\unpackedtarball\python3\objects\dictobject.c(1646) python35_d.dll!_Py_Dealloc(_object * op) Line 1795 at c:\lo\src\core2\workdir\unpackedtarball\python3\objects\object.c(1795) python35_d.dll!subtype_dealloc(_object * self) Line 1194 at c:\lo\src\core2\workdir\unpackedtarball\python3\objects\typeobject.c(1194) python35_d.dll!_Py_Dealloc(_object * op) Line 1795 at c:\lo\src\core2\workdir\unpackedtarball\python3\objects\object.c(1795)
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - fpicker/source
fpicker/source/win32/VistaFilePickerEventHandler.cxx |1 + fpicker/source/win32/asyncrequests.cxx |9 - 2 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 1ed8416703d1f1a33690cc47fd6cb6b2b3520cf1 Author: Jan-Marek Glogowski AuthorDate: Fri Jan 25 10:05:36 2019 + Commit: Xisco Faulí CommitDate: Mon Jan 28 13:12:14 2019 +0100 tdf#122927 prevent SolarMutex deadlock on join() The AsyncRequests thread can be blocked in a SolarMutexGuard, so we have to release the mutex before calling join(). But there is also a static AsyncRequests object inside the VistaFilePickerEventHandler::impl_sendEvent function, which will just be cleaned up at DLL atexit. "Luckily" it won't ever run, so it doesn't need to be joined and we can use isRunning to detect it, prevent releasing a non- existing SolarMutex at this point and so won't crash LO on exit. Change-Id: I0c56b89a11f96be54e82b756c5e18a058b04a41d Reviewed-on: https://gerrit.libreoffice.org/66901 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski (cherry picked from commit 5b2f1243bd44b450da26c8344b3ee459f8e88f6c) Reviewed-on: https://gerrit.libreoffice.org/66913 Reviewed-by: Xisco Faulí diff --git a/fpicker/source/win32/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/VistaFilePickerEventHandler.cxx index 0bf9165f9e48..e770bef25406 100644 --- a/fpicker/source/win32/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/VistaFilePickerEventHandler.cxx @@ -289,6 +289,7 @@ public: void VistaFilePickerEventHandler::impl_sendEvent( EEventType eEventType, ::sal_Int16 nControlID) { +// See special handling in ~AsyncRequests for this static static AsyncRequests aNotify(RequestHandlerRef(new AsyncPickerEvents())); ::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer( cppu::UnoType::get()); diff --git a/fpicker/source/win32/asyncrequests.cxx b/fpicker/source/win32/asyncrequests.cxx index 766a2309d991..c7fb3f73878e 100644 --- a/fpicker/source/win32/asyncrequests.cxx +++ b/fpicker/source/win32/asyncrequests.cxx @@ -75,7 +75,14 @@ AsyncRequests::~AsyncRequests() aLock.clear(); // <- SYNCHRONIZED -join(); +// The static AsyncRequests aNotify in VistaFilePickerEventHandler::impl_sendEvent +// is destructed at DLL atexit. But it won't run, so needs no join and release of +// the already destructed SolarMutex, which would crash LO on exit. +if (isRunning()) +{ +SolarMutexReleaser aReleaser; +join(); +} } void AsyncRequests::triggerJobExecution() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - fpicker/source
fpicker/source/win32/VistaFilePickerImpl.cxx | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) New commits: commit 414246683899928014ea11ec07caebdfdf8aaee4 Author: Mike Kaganski AuthorDate: Thu Dec 6 01:32:35 2018 +0300 Commit: Katarina Behrens CommitDate: Mon Dec 10 11:54:22 2018 +0100 tdf#119747 FileSaveDialog: remove duplicate extension on Windows This properly reimplements the fix, only changing the display strings sent to native dialog, and never modifying the filter names as seen by LibreOffice code. Change-Id: Iee5f09acd6b12c0ba8b7568b16f8ab07821006ee Reviewed-on: https://gerrit.libreoffice.org/64656 Tested-by: Jenkins Reviewed-by: Katarina Behrens Reviewed-by: Thorsten Behrens Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/64840 diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx index ff0cf2c27956..6c168a244fa0 100644 --- a/fpicker/source/win32/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/VistaFilePickerImpl.cxx @@ -147,8 +147,17 @@ bailout: return sURL; } +// Vista file picker shows the filter mask next to filter name in the list; so we need to remove the +// mask from the filter name to avoid duplicating masks +static OUString lcl_AdjustFilterName(const OUString& sName) +{ +const sal_Int32 idx = sName.indexOf("(."); +return (idx > 0) ? sName.copy(0, idx).trim() : sName; +} -static ::std::vector< COMDLG_FILTERSPEC > lcl_buildFilterList(CFilterContainer& rContainer) +// rvStrings holds the OUStrings, pointers to which data are stored in returned COMDLG_FILTERSPEC +static ::std::vector lcl_buildFilterList(CFilterContainer& rContainer, + std::vector& rvStrings) { ::std::vector< COMDLG_FILTERSPEC > lList ; CFilterContainer::FILTER_ENTRY_T aFilter; @@ -158,7 +167,8 @@ static ::std::vector< COMDLG_FILTERSPEC > lcl_buildFilterList(CFilterContainer& { COMDLG_FILTERSPEC aSpec; -aSpec.pszName = o3tl::toW(aFilter.first.getStr()) ; +rvStrings.push_back(lcl_AdjustFilterName(aFilter.first)); // to avoid dangling pointer +aSpec.pszName = o3tl::toW(rvStrings.back().getStr()); aSpec.pszSpec = o3tl::toW(aFilter.second.getStr()); lList.push_back(aSpec); @@ -824,7 +834,9 @@ void VistaFilePickerImpl::impl_sta_setFiltersOnDialog() // SYNCHRONIZED-> ::osl::ResettableMutexGuard aLock(m_aMutex); -::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters); +std::vector vStrings; // to hold the adjusted filter names, pointers to which will be +// stored in lFilters +::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters, vStrings); OUStringsCurrentFilter = m_lFilters.getCurrentFilter(); sal_Int32 nCurrentFilter = m_lFilters.getFilterPos(sCurrentFilter); TFileDialogiDialog= impl_getBaseDialogInterface(); @@ -991,7 +1003,9 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest) { // COM dialog base on 1 ... filter container on 0 .-) ::size_t nRealIndex = (nFileType-1); -::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters); +std::vector vStrings; +::std::vector lFilters += lcl_buildFilterList(m_lFilters, vStrings); if ( nRealIndex < lFilters.size() ) { PCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits