Bug 160565 - KDE/Qt UI - Program freezes after "save as"
Summary: KDE/Qt UI - Program freezes after "save as"
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: All All
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:24.8.0 target:24.2.4
Keywords:
: 160416 160624 160864 161339 (view as bug list)
Depends on:
Blocks: Qt6
  Show dependency treegraph
 
Reported: 2024-04-06 13:36 UTC by Doug B
Modified: 2024-06-05 11:03 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
screenrecording of how to reproduce the bug (1.98 MB, video/mp4)
2024-04-06 13:36 UTC, Doug B
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug B 2024-04-06 13:36:29 UTC
Created attachment 193543 [details]
screenrecording of how to reproduce the bug

I have encountered a bug that should be related to the Qt/KDE UI for Libreoffice. This does not happen for the Gtk or native Libreoffice dialogs.

I am on Arch Linux and am using the libreoffice-fresh package from Arch's repos. 
I am on the latest version of KDE Plasma on Arch (full details at the bottom of this psot)

How to reproduce:
- Create a new file in Writer (or any other Libreoffice program)
- Save it
- It will save successfully but the program will hang.

See my screen recording attached.

No error pops up in the terminal, but this shows when the save dialog opens: "kf.kio.filewidgets.kfilefiltercombo: Could not find file filter"

System Details
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.6.24-1-lts (64-bit)
Graphics Platform: X11
Processors: 12 × 12th Gen Intel® Core™ i7-1255U
Memory: 62.5 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Comment 1 Doug B 2024-04-06 21:54:43 UTC
This seems to be present on these VCL plugins: qt5, qt6, kf5, kf6.

The Gtk related dialogs seemed to work ok.
Comment 2 Oleksandr Natalenko 2024-04-13 15:43:56 UTC
Can confirm this on my two Arch KDE machines as well.

Maybe related to this: https://bugs.kde.org/show_bug.cgi?id=483439 / https://bugs.kde.org/show_bug.cgi?id=471941 ?
Comment 3 Oleksandr Natalenko 2024-04-13 15:57:47 UTC
Possibly related: https://bugs.documentfoundation.org/show_bug.cgi?id=160624

For me I've verified SAL_USE_VCLPLUGIN=gtk3 works around this.
Comment 4 Oleksandr Natalenko 2024-04-13 16:00:14 UTC
Also possibly related: https://bugs.documentfoundation.org/show_bug.cgi?id=160416
Comment 5 Oleksandr Natalenko 2024-05-03 15:40:07 UTC
Possible fix: https://codereview.qt-project.org/c/qt/qtbase/+/556573
Comment 6 Robert Großkopf 2024-05-04 06:26:49 UTC
Which version of LO do you use?

Couldn't confirm this behavior with

Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

on OpenSUSE 15.6

but: There is no KDE 6 available for my system yet.
Comment 7 Oleksandr Natalenko 2024-05-04 08:58:09 UTC
In Arch I was able to reproduce this with 24.2.2.2. This must be KDE6-specific.
Comment 8 Albert Astals Cid 2024-05-07 07:40:34 UTC
> This seems to be present on these VCL plugins: qt5, qt6, kf5, kf6.

Are you sure? I can not reproduce this with qt5, only with qt6/kf6. Note that for example if you do SAL_USE_VCLPLUGIN=kf5 libreoffice in Arch it will use the kf6 one since kf5 isn't packaged.

For me this only happens on Plasma+X11 not on Plasma+Wayland. Can you also confirm?

The patch at https://codereview.qt-project.org/c/qt/qtbase/+/556573 does not fix it, Arch has that backported and doesn't help.
Comment 9 Michael Weghorn 2024-05-17 11:53:24 UTC
(In reply to Albert Astals Cid from comment #8)
> Are you sure? I can not reproduce this with qt5, only with qt6/kf6. Note
> that for example if you do SAL_USE_VCLPLUGIN=kf5 libreoffice in Arch it will
> use the kf6 one since kf5 isn't packaged.
> 
> For me this only happens on Plasma+X11 not on Plasma+Wayland. Can you also
> confirm?
> 
> The patch at https://codereview.qt-project.org/c/qt/qtbase/+/556573 does not
> fix it, Arch has that backported and doesn't help.

I can confirm all of the above: no issue with kf5, only with QT_QPA_PLATFORM=xcb with qt6/kf6, not with QT_QPA_PLATFORM=wayland

The issue is triggered by a call to `QWidget::winId`, doesn't happen any more with this local test change in place (needs further investigation):

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index d4a43fc7a544..ac2044b85302 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -1340,7 +1340,10 @@ void QtFrame::ResolveWindowHandle(SystemEnvData& rData) const
         return;
     assert(rData.platform != SystemEnvData::Platform::Invalid);
     if (rData.platform != SystemEnvData::Platform::Wayland)
-        rData.SetWindowHandle(static_cast<QWidget*>(rData.pWidget)->winId());
+    {
+        // TODO: identify callers of this method and avoid calling this to unbreak things
+        //rData.SetWindowHandle(static_cast<QWidget*>(rData.pWidget)->winId());
+    }
 }
Comment 10 Michael Weghorn 2024-05-17 11:54:40 UTC
*** Bug 160416 has been marked as a duplicate of this bug. ***
Comment 11 Michael Weghorn 2024-05-17 11:55:49 UTC
*** Bug 160624 has been marked as a duplicate of this bug. ***
Comment 12 Commit Notification 2024-05-18 04:56:28 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2f4103da5625a9b90eb41d5c767a248a8d0b4255

tdf#160565 tdf#145735 qt: Avoid native window handles for Qt 6

It will be available in 24.8.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 13 Michael Weghorn 2024-05-18 04:57:51 UTC
Fixed in master now.
Backport for 24-2 pending in Gerrit:
https://gerrit.libreoffice.org/c/core/+/167813
Comment 14 Commit Notification 2024-05-18 13:18:32 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/9497be2e668c19aedc588588bf9dfed9338afe54

tdf#160565 tdf#145735 qt: Avoid native window handles for Qt 6

It will be available in 24.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.
Comment 15 Michael Weghorn 2024-05-21 12:48:26 UTC
*** Bug 160864 has been marked as a duplicate of this bug. ***
Comment 16 Stéphane Guillou (stragu) 2024-06-05 11:03:15 UTC
*** Bug 161339 has been marked as a duplicate of this bug. ***