Bug 124652

Summary: gtk3_kde5: Hang/crash when using folderpicker from Java extension
Product: LibreOffice Reporter: Michael Weghorn <m.weghorn>
Component: graphics stackAssignee: Michael Weghorn <m.weghorn>
Status: RESOLVED FIXED    
Severity: normal CC: m.weghorn
Priority: medium    
Version: 6.1.5.2 release   
Hardware: All   
OS: All   
Whiteboard: target:6.3.0 target:6.2.4
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 102495    
Attachments: Sample extension to reproduce the issue
GDB backtrace with master

Description Michael Weghorn 2019-04-10 11:23:35 UTC
Created attachment 150659 [details]
Sample extension to reproduce the issue

Using the folder picker from a Java extension causes LibreOffice to hang when using the gtk3_kde5 VCL plugin.

Steps to reproduce:

0) use KDE Plasma
1) install the attached demo extension
2) start LibreOffice Writer with the gtk3_kde5 VCL plugin:
   SAL_USE_VCLPLUGIN=gtk3_kde5 libreoffice --writer
3) click the "Test Extension" -> "Save (new)" menu item
   -> a native Qt folder picker appears
4) select any directory and click "OK"

Result: LibreOffice hangs

using e.g. LibreOffice from Debian testing:

Version: 6.1.5.2
Build ID: 1:6.1.5-2
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded
Comment 1 Michael Weghorn 2019-04-10 11:28:01 UTC
Created attachment 150660 [details]
GDB backtrace with master
Comment 2 Michael Weghorn 2019-04-10 11:28:57 UTC
I'm self-confirming according to [1] since the bug has originally been reported by somebody else in our internal issue tracker.

According to the bug reporter, the relevant Java code in the extension is this one:

  XMultiComponentFactory xMCF = m_xContext.getServiceManager();
  Object obj = xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FolderPicker", m_xContext);
  XFolderPicker picker = UnoRuntime.queryInterface(XFolderPicker.class, obj);
  short res = picker.execute();

Using a current debug build of master crashes with a failed assert, s. attached bt

Version: 6.3.0.0.alpha0+
Build ID: f3fc127dc007f32355859ae4fc7d34916c500a18
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3_kde5; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-US
Calc: threaded


[1] https://wiki.documentfoundation.org/QA/Guidelines_for_public_and_private_sector_deployments
Comment 3 Michael Weghorn 2019-04-10 11:40:16 UTC
Gerrit change: https://gerrit.libreoffice.org/#/c/70519/
Comment 4 Commit Notification 2019-04-10 16:04:23 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/728ee3839ea94e3391c36a847bf6b28c12ad7647%5E%21

tdf#124652 Guard Gtk3KDE5FolderPicker::execute with SolarMutexGuard

It will be available in 6.3.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.
Comment 5 Commit Notification 2019-04-11 05:23:20 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/62d6082f5a7a87631a4316b2107f1d8fc7e8c820%5E%21

tdf#124652 Guard Gtk3KDE5FolderPicker::execute with SolarMutexGuard

It will be available in 6.2.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.