maxrd2 added a comment.
Thank you! QEventLoop and creating window with new operator did it. Now the only problem is that no matter how i close the window from code it's not reproducing behavior. Only closing the window manually through window manager works. Have tried: QApplication::postEvent(mw, new QCloseEvent); // this one does absolutely nothing QApplication::postEvent(mw, new QDeferredDeleteEvent); QTimer::singleShot(1000, [&](){ QApplication::sendEvent(mw, new QDeferredDeleteEvent); }); mv.close(); QTimer::singleShot(1000, [&](){ mv.close(); }); The close event from window manager is QDeferredDeleteEvent and has spontaneous flag, i didn't notice any other differences in debugger. Any ideas? REPOSITORY R263 KXmlGui BRANCH fix-window-state-save REVISION DETAIL https://phabricator.kde.org/D13808 To: maxrd2, #kde_applications, dfaure, elvisangelaccio, broulik, cfeck Cc: wbauer, aacid, ngraham, kde-frameworks-devel, michaelh, bruns