https://bugs.kde.org/show_bug.cgi?id=450325
Michael Pyne <mp...@kde.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Latest Commit| |https://invent.kde.org/fram | |eworks/kjobwidgets/commit/b | |8752085d2a480dfc93d2d422c46 | |3a59d46af5ee Status|REPORTED |RESOLVED --- Comment #22 from Michael Pyne <mp...@kde.org> --- Git commit b8752085d2a480dfc93d2d422c463a59d46af5ee by Michael Pyne. Committed on 02/07/2022 at 22:13. Pushed by mpyne into branch 'work-bug-450325-fix-crash'. ui-server: Fix crash by only re-registering live KJobs. This addresses a frequently-reported crash in the job tracker for KUiServerV2 that occurs when attempting to re-register new job views for active KJobs after a new UI server comes online. Although I have not been able to reproduce the crash myself, (by attempting to use both long-lived and short-lived file transfers from Dolphin and restarting plasmashell), inspection of the code shows that it is possible for there to be deleted KJobs pointing to JobView objects during some portions of the job tracker's lifetime. The current code deals with this in situations including DBus calls to create a U/I view for a KJob (the KJob may terminate before the DBus reply is received) and even a short delay that can be optionally introduced (the KJob may terminate before the delay elapses). A QPointer<KJob> is used as a guard in these situations, but there is no similar guard for the re-registration code. In this case we cannot use QPointer<KJob> to guard the job's lifetime because the KJob must be alive when the QPointer<KJob> is created, and this crash occurs when the KJob is terminated. However the KJob's destruction should lead to the unregisterJob() function being called, which handles removing the terminated KJob from the map of job views with only one exception, where instead the job view for the KJob has its "terminated" pending status set. So the fix here checks for the "terminated" state in the same way as performed in requestView(), and if the KJob is terminated, handles requesting the job view to terminate the U/I and finally removing the terminated KJob from the map of job views. By doing this, we avoid passing a deleted KJob to the registerJob() function, which will attempt to dereference it and crash the application. M +16 -4 src/kuiserverv2jobtracker.cpp https://invent.kde.org/frameworks/kjobwidgets/commit/b8752085d2a480dfc93d2d422c463a59d46af5ee -- You are receiving this mail because: You are watching all bug changes.