Seems like switching to PMF connections has changed the order signals
are processed in, resulting in the UI being initialized after the
session manager asks for saving the UI state (for whatever reason).
Make this less fragile (and avoid a crash when using KDE) by
connecting to the session manager only after initializing the UI, and
replace the initUi() slot by a lambda while we're at it.
QtUiApplication::QtUiApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
QtUiApplication::QtUiApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
- connect(this, &QGuiApplication::commitDataRequest, this, &QtUiApplication::commitData, Qt::DirectConnection);
- connect(this, &QGuiApplication::saveStateRequest, this, &QtUiApplication::saveState, Qt::DirectConnection);
-
#if QT_VERSION >= 0x050600
QGuiApplication::setFallbackSessionManagementEnabled(false);
#endif
#if QT_VERSION >= 0x050600
QGuiApplication::setFallbackSessionManagementEnabled(false);
#endif
_client = std::make_unique<Client>(std::make_unique<QtUi>());
// Init UI only after the event loop has started
_client = std::make_unique<Client>(std::make_unique<QtUi>());
// Init UI only after the event loop has started
- // TODO Qt5: Make this a lambda
- QTimer::singleShot(0, this, &QtUiApplication::initUi);
-}
-
-
-void QtUiApplication::initUi()
-{
- QtUi::instance()->init();
+ QTimer::singleShot(0, this, [this]() {
+ QtUi::instance()->init();
+ connect(this, &QGuiApplication::commitDataRequest, this, &QtUiApplication::commitData, Qt::DirectConnection);
+ connect(this, &QGuiApplication::saveStateRequest, this, &QtUiApplication::saveState, Qt::DirectConnection);
- // Needs to happen after UI init, so the MainWin quit handler is registered first
- Quassel::registerQuitHandler(quitHandler());
+ // Needs to happen after UI init, so the MainWin quit handler is registered first
+ Quassel::registerQuitHandler(quitHandler());
- resumeSessionIfPossible();
+ resumeSessionIfPossible();
+ });
*/
bool applySettingsMigration(QtUiSettings settings, const uint newVersion);
*/
bool applySettingsMigration(QtUiSettings settings, const uint newVersion);
-private slots:
- void initUi();
-
protected:
std::unique_ptr<Client> _client;
protected:
std::unique_ptr<Client> _client;