<table><tr><td style="">sitter created this revision.<br />sitter added a reviewer: broulik.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />sitter requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15638">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><tt style="background: #ebebeb; font-size: 13px;">KNotification::close()</tt> causes the manager to close the plugin for the<br />
notification and after that KNotification will call deleteLater() on<br />
itself. In the canberra variant of NotifyByAudio we handled this by calling<br />
ca_context_cancel to abort playback of the audio. This ultimately would<br />
still cause a finishCallback once the playback actually cancelled. The<br />
callback does arrive in an undefined amount of loop cycles later though.<br />
Put together this allowed for timing issues where deleteLater would run<br />
before the finishCallback arrived, giving finishCallback the risk of<br />
accessing a KNotification object past its lifetime and segfaulting.</p>

<p>To prevent this from happening we'll finishNotification in the plugin's<br />
close(). This drops the notification out of the mapping hashes and tells<br />
the manager that we are done. finishCallback now returns immediately if it<br />
cannot find a mapping for a notification (i.e. it was close()d already).</p>

<p>CHANGELOG: Fixed a crash caused by bad lifetime management of canberra-based audio notification<br />
BUG: 398695</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>added qdebugs. without patch close() and thus deleteLater() happens before finishCallback() but the callback still does its thing. with patch finishCallback is noop.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R289 KNotifications</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15638">https://phabricator.kde.org/D15638</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/notifybyaudio_canberra.cpp</div></div></div><br /><div><strong>To: </strong>sitter, broulik<br /><strong>Cc: </strong>kde-frameworks-devel, jtamate, michaelh, ngraham, bruns<br /></div>