Avoid crash during session restore

Authored by tobiasdeiminger on Oct 27 2018, 11:49 AM.

Description

Avoid crash during session restore

Summary:
Do all access to the passed KConfigGroup really synchronous to KMainWindow::readProperties, then we're safe.

Currently kxmlgui can't guarantee that the passed KConfigGroup is still valid after our call to Shell::openUrl(). This is because inside Shell::openUrl, QDialog::exec may get called. The stacked event loop processes all kinds of asynchronous events, and litterally *anything* can happen. E.g. incoming ICE and DBus messages may be processed. In bug 395765 it happened that XSMP SafeYourself was processed, which calls KConfigGui::setSessionConfig, which leaves the KConfig pointer inside KConfigGroup dangling.

BUGS: 395765

Test Plan:

  • get recent Qt5 and KF5
  • manually save desktop session while a document is open in okular
  • modify ~/.config/session/okular_<sessionid> so that Urls points to non existing file
  • manually restore session with okular -session <session_id>, dialog will open and warn about non existent file
  • okular shall not crash after closing that dialog

Reviewers: aacid

Reviewed By: aacid

Subscribers: aacid, okular-devel

Tags: Okular

Differential Revision: https://phabricator.kde.org/D16457

Details

Committed
tobiasdeimingerOct 29 2018, 8:44 PM
Reviewer
aacid
Differential Revision
D16457: Avoid crash during session restore
Parents
R223:dcacd830f47f: Don't call 'KDirWatch::stopScan()'
Branches
Unknown
Tags
Unknown