Created attachment 176648 [details] Test File Picker When file picker dialog created using: CreateUnoService("com.sun.star.ui.dialogs.FilePicker") is executed, LibreOffice hangs (CPU usage is at 0% in task manager). Dialog itself is not made visible. Please see one of the attached files with test macros, this was tested with Calc and Writer. Tested with 7.2.0.1, 7.2.0.4 and 7.2.3.2 (version info below) Version: 7.2.3.2 (x64) / LibreOffice Community Build ID: d166454616c1632304285822f9c83ce2e660fd92 CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win Locale: pl-PL (pl_PL); UI: pl-PL Calc: CL Version 7.1.3.2 and 7.0.6.2 worked without hanging.
Created attachment 176649 [details] Writer version
Confirmed in: Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community Build ID: cfbcbb605dbaaea45dc9ac5ea792d72cb2f2c1bb CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: CL Does not hang in: Version: 7.1.0.3 (x64) / LibreOffice Community Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: CL
Remark: If the macro is executed directly in the Basic IDE, the macro never hangs.
Another workaround is using the OfficeFilePicker directly in your code or as a preference: Extras/Options -> Libreoffice: Dialogs for Open/Save [x] Use office dialogs This is a blocker for version update for us, as we need the preview from the Windows FilePicker in some automation use cases.
This seems to have begun at the below commit. Adding Cc: to Matt K and Mike Kaganski; Could you possibly take a look at this one? Thank you! commit 1c1226709c6be39c5462f5e6e1262ca630b30b34 author Matt K <mattkse@gmail.com> Wed Apr 21 17:34:16 2021 -0500 committer Mike Kaganski <mike.kaganski@collabora.com> Thu Apr 22 22:20:55 2021 +0200 tree 14dc0f683da5bc6c8e08ea7db516da174960679f parent 04bd21d483c33c5011e31ac12d02c9e00dc410ce tdf#106282 Change Windows File Dialog to run on the main thread | https://gerrit.libreoffice.org/c/core/+/114482 c2e223873620c4d44247c835aff279053f574dc6 is the first bad commit commit c2e223873620c4d44247c835aff279053f574dc6 Author: Norbert Thiebaud <nthiebaud@gmail.com> Date: Thu Apr 22 13:29:23 2021 -0700 source 1c1226709c6be39c5462f5e6e1262ca630b30b34 source 1c1226709c6be39c5462f5e6e1262ca630b30b34
(In reply to Andreas Heinisch from comment #5) > Adding Cc: to Matt K and Mike Kaganski; Could you possibly take a look at > this one? Thank you! I took a quick look and it seems like the main thread is blocked waiting for something to happen. I'm not familiar with how macros use (or don't) the main thread, but if the main thread is blocked before the file picker opens it could just be an endless wait situation/deadlock. Haven't debugged enough to say more or suggest a solution.
Created attachment 179869 [details] Callstacks for recent LO build in file open scenarios (including macro in IDE)
I've attached a file with the callstacks for normal file open scenarios. It looks like we could change the "macro in app" path to use reflection just as is done in the IDE callstack which also happens on the main thread. There may be a easier solution but I can't seem to get a build of LO with symbols with the old behavior to see what we were doing before and see what changed. I tried checking out a tag on git and downloading an archived version, but can't get any symbols working yet.
I looked further and I'm seeing that the latest version hangs when clicking on the macro, but when I look at it in the debugger it doesn't hang and works as expected. Must be some kind of timing issue or something related to how UNO works in dispatching. It's also worth noting that the macro causes the file picker to be opened on a background thread, but surprisingly it doesn't crash when cancelling a long running search operation as it was before bug 106282 was fixed.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b8bb44161aeb6e00526a38343b63e678ce7d4a1a tdf#146007: make sure to not hold solar mutex It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/e5bd911b01d9437841e2ec59a233ce6a6baa4dbf tdf#146007: make sure to not hold solar mutex It will be available in 7.3.4. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.