Ownership model of GlobalShortcutsRegistry and KGlobalAccelD
Problem
KGlobalAccelD uses GlobalShortcutsRegistry a lot, even in its dtor.
The issue is that GlobalShortcutsRegistry is created by KGlobalAccelD as a Q_GLOBAL_STATIC on the stack. If you want to manage KGlobalAccelD's lifetime also via stack that gonna crash.
I can think of two solutions for this problem:
Solution 1:
Access GlobalShortcutsRegistry in KGlobalAccelD's dtor via the the GlobalShortcutsRegistry::self() getter and check if it exists.
Solution 2:
Own GlobalShortcutsRegistry by KGlobalAccelD instead of having it as a Q_GLOBAL_STATIC.
Is there a preference for one of the solutions?
Edited by Roman Gilg