Bug 355545 - KDBusService constructor is crashing on calling exit()
Summary: KDBusService constructor is crashing on calling exit()
Status: CONFIRMED
Alias: None
Product: frameworks-kdbusaddons
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 355479 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-18 15:07 UTC by Jan Grulich
Modified: 2020-12-21 17:39 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Grulich 2015-11-18 15:07:14 UTC
I'm reporting a bug because I'm not sure how to fix this. It looks that KDBusService is crashing when calling exit() in its constructor. This is easily reproducible with kde5-nm-connection-editor. My version of KDE Frameworks is 5.16.0.

Fedora bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1282736
https://bugzilla.redhat.com/show_bug.cgi?id=1218836

Reproducible: Sometimes

Steps to Reproduce:
1) Open kde5-nm-connection-editor in konsole
2) Keep it opened and open it again from a different session
3) Observe crash 



I tried to replace exit() with quick_exit() and it helped, I'm just not sure if it's correct fix and also quick_exit is from c++11.
Comment 1 Jan Grulich 2015-11-19 12:46:11 UTC
*** Bug 355479 has been marked as a duplicate of this bug. ***
Comment 2 Martin Sandsmark 2016-04-10 15:31:21 UTC
Copying in my comment on https://git.reviewboard.kde.org/r/127625/ :

It seems like it is this that it happening: https://bugreports.qt.io/browse/QTBUG-48709

From my understanding it can't really be fixed, short of somehow getting KDBusService to delete the QApplication before calling exit(), which might get nasty with QApplications allocated on the stack?

In any case it seems to be a general bug with KDBusService and how it is supposed to be used, not something that we can easily fix in konsole.

See also my workaround here: https://git.reviewboard.kde.org/r/127626/

It should be fixed in KDBusService, using a similar workaround in all apps that use it is not feasible. I'm not sure how it can be worked around, though, it can't just delete the QApplication itself, since pretty much everyone allocate it on the stack.
Comment 3 Justin Zobel 2020-12-17 05:23:11 UTC
Thank you for the crash report.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 4 Martin Sandsmark 2020-12-21 17:38:06 UTC
It is an architectural problem in KDBusService, so it is still not fixed (still calling exit directly e. g. here: https://invent.kde.org/frameworks/kdbusaddons/-/blob/master/src/kdbusservice.cpp#L211)
Comment 5 Martin Sandsmark 2020-12-21 17:39:27 UTC
The only way to fix it that I know is for the API to be fundamentally changed so that the calling application is itself responsible for exiting.