Fix crash at shutdown after showing a tooltip
ClosedPublic

Authored by hallas on Mar 13 2019, 7:33 PM.

Details

Summary

Fix crash at shutdown after showing a tooltip. The commit
94d7e1471e0a81b72285795ad91c4f6196157ae4 introduced a crash that occurs
when closing Dolphin after Dolphin has showed a tooltip. This happens
because the ToolTipManager::showToolTip function calls the
KToopTipWidget::showBelow function passing in the pointer to the
DolphinFileMetaDataWidget. But this also passes the ownership of the
pointer to the KToopTipWidget as long as a new tooltip is not shown. The
problem is that at shutdown, the KToopTipWidget instance will be
destoyed first and therefore also destroy the DolphinFileMetaDataWidget
instance (which the ToolTipManager still owns through the
QScopedPointer) causing it to be deleted twice. The fix for this is
simply to swap the order of these two members so that the
DolphinFileMetaDataWidget is destroyed first by the QScopedPointer
thereby removing it from the KToopTipWidget if it has been set as it's
parent.

Test Plan

Open Dolphin
Show a Tool Tip
Close Dolphin

Diff Detail

Repository
R318 Dolphin
Branch
fix_crash_with_tooltips (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 9546
Build 9564: arc lint + arc unit
hallas created this revision.Mar 13 2019, 7:33 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptMar 13 2019, 7:33 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
hallas requested review of this revision.Mar 13 2019, 7:33 PM

a crash that occurs when closing Dolphin after Dolphin has showed a tooltip

Did you mean "while Dolphin is showing a tooltip" ? That's the only way I was able to reproduce the crash.

a crash that occurs when closing Dolphin after Dolphin has showed a tooltip

Did you mean "while Dolphin is showing a tooltip" ? That's the only way I was able to reproduce the crash.

I could also reproduce the crash if Dolphin had just showed a single tooltip, but it had to have shown it just before closing Dolphin. In other words the pointer being held in m_fileMetaDataWidget has to have been passed to the m_tooltipWidget, then the crash would happen.

elvisangelaccio accepted this revision.Mar 17 2019, 5:04 PM

I could also reproduce the crash if Dolphin had just showed a single tooltip, but it had to have shown it just before closing Dolphin

Got it. Please push to the Applications/19.04 branch.

This revision is now accepted and ready to land.Mar 17 2019, 5:04 PM
hallas closed this revision.Mar 17 2019, 5:09 PM

I could also reproduce the crash if Dolphin had just showed a single tooltip, but it had to have shown it just before closing Dolphin

Got it. Please push to the Applications/19.04 branch.

Pushed to master and Applications/19.04

I could also reproduce the crash if Dolphin had just showed a single tooltip, but it had to have shown it just before closing Dolphin

Got it. Please push to the Applications/19.04 branch.

Pushed to master and Applications/19.04

FYI you should have pushed only to Applications/19.04 and then merge it on master ;)

I could also reproduce the crash if Dolphin had just showed a single tooltip, but it had to have shown it just before closing Dolphin

Got it. Please push to the Applications/19.04 branch.

Pushed to master and Applications/19.04

FYI you should have pushed only to Applications/19.04 and then merge it on master ;)

Sorry about that :/

I am still struggling a bit with this workflow and I haven't found super good documentation on it.