Bug 467130 - When libkxmlgui gets loaded into a non-qt app it may mess up application's shortcut fremework.
Summary: When libkxmlgui gets loaded into a non-qt app it may mess up application's sh...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kxmlgui
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-09 22:21 UTC by Alexander Golubev (Fat-Zer)
Modified: 2025-02-07 13:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Golubev (Fat-Zer) 2023-03-09 22:21:39 UTC
SUMMARY

When libkxmlgui gets loaded into a non-kde qt app it may mess up application's shortcut framework. This happens because libkxmlgui installs[1] an event filter, which tries to handle shortcuts on its own. Besides it's a quiet dirty practice in general to mess with others global objects with upon lib bootstrap, there are some legit reasons when a non-kde app may load a kde library. i.e. that may happen because the app depends upon a library with optional kde support or via Qt plugin system.

The later one is what exactly happened in freecad[2].

So could you please change the libkxmlgui behaviour so it won't install the event filter on library load or at least do it just for kde apps?

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Gentoo/Linux kernel 5.15.88
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

[1]: https://github.com/KDE/kxmlgui/blob/master/src/kactionconflictdetector.cpp
[2]: https://github.com/FreeCAD/FreeCAD/issues/8708#issuecomment-1456471966
Comment 1 Bug Janitor Service 2025-01-19 19:42:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kxmlgui/-/merge_requests/266
Comment 2 Nicolas Fella 2025-02-07 13:36:38 UTC
Git commit abcc83630194b1eaf3732e0ccb2fad8de8ffbb9e by Nicolas Fella, on behalf of Christoph Cullmann.
Committed on 07/02/2025 at 13:15.
Pushed by nicolasfella into branch 'master'.

Create the conflict detector only if some main window got created

Before we did that on library load, meaning everything linking
against KXmlGui, even if only indirectly via the plasma-integration
plugin, will get this, which is usually unwanted

M  +1    -1    src/CMakeLists.txt
R  +0    -11   src/kactionconflictdetector_p.h [from: src/kactionconflictdetector.cpp - 087% similarity]
M  +10   -0    src/kmainwindow.cpp

https://invent.kde.org/frameworks/kxmlgui/-/commit/abcc83630194b1eaf3732e0ccb2fad8de8ffbb9e