Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83328

X11 + Session Manager Regression results in multiple prompts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.14.0, 5.15.0 Beta3
    • None
    • Linux/X11

      Qt XCB apps get two "do you want to save changes" prompts on logout since 1b6db1849477be30ef0ca52c288d358b911ea1e4

      On X previously the shutdown system would be as follows:

      1) we receive sm_performSaveYourself. This emits QGuiApplication::commitDataRequest

      2) we receive sm_dieCallback this creates a quitEvent, which QCoreApplication handles and quits

      Since the patch that became effectively:

      1) we receive sm_performSaveYourself. This emits QGuiApplication::commitDataRequest

      2) we receive sm_dieCallback this creates a quitEvent, which QApplication handles and iterate through windows closing them.

       

      It is standard practice for an app to show a "do you want to save changes" prompt on commitDataRequest, where the QSessionManager is exposed and we can reply. We should not close windows at this step as some other client could cancel the shutdown. It is also common to show the prompt in QWindow::closeEvent of main windows, to capture the user closing the window through the window manager.

      Qt's own demo app in examples/widgets/mainwindows/application does exactly this.

      Running this against an X11 session manager such as ksmserver from KDE Plasma, making a change and triggering a logout will result in the two prompts.

      -------

      As a fast fix can we add a if(platformName() == "osx") round the new behaviour?

      Then do something properly for Qt6, such as a hint in the closeEvent as to why we're closing.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vestbo Tor Arne Vestbø
            davidedmundson David Edmundson
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes