https://bugs.kde.org/show_bug.cgi?id=480652
            Bug ID: 480652
           Summary: Regression when closing/hiding the main window
    Classification: Plasma
           Product: kwin
           Version: master
          Platform: Neon
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: kwin-bugs-n...@kde.org
          Reporter: alexander.reinho...@kdemail.net
  Target Milestone: ---

Hello,

I am the developer of Smb4K and I am currently testing my application under
Plasma 6 / KWin 6 on KDE neon unstable. I found some regressions compared to
Plasma 5 / KWin 5 regarding the closing of the main window. I use KWin with
Wayland, the default on KDE neon unstable.

SUMMARY

There are two things that do not work as expected anymore and which worked fine
before:

(1) Closing the main window through the close button of the window. This should
result in hiding the main window to the system tray.
(2) Closing the main window through the Quit action. This should result in
exiting the application.

The main window has a queryClose() function that currently looks like this:

bool Smb4KMainWindow::queryClose()
{
    if (!m_quitting && !qApp->isSavingSession() && isVisible()) {
        // This part has been copied from JuK application.
        KMessageBox::information(this,
                                 i18n("<qt>Closing the main window will keep
Smb4K running in the system tray.<br>"
                                      "Use <i>Quit</i> from the <i>File</i>
menu to quit the application.</qt>"),
                                 i18n("Docking"),
                                 QStringLiteral("DockToSystemTrayInfo"));
        setVisible(false);
        return false;
    }

    return true;
}

There is also a slot connected to the Quit action:

void Smb4KMainWindow::slotQuit()
{
    m_quitting = true;
    // saveSettings();
    close();
    QCoreApplication::quit();
} 

Regression 1:
When queryClose() is called and the application is not supposed to be exited,
it returns false as it should in that case. However, after the message box is
shown, the main window won't hide. That worked under KWin 5 perfectly.

Regression 2:
When queryClose() is called through the Quit action, the main window will
eventually be closed, but Smb4K is still running and seem to enter an infinite
loop. When running Smb4K in gdb and killing it when it is in the loop, I get
this output:

Thread 1 "smb4k" received signal SIGINT, Interrupt.
0x00007ffff73e9934 in QApplication::topLevelWidgets() () from
/lib/x86_64-linux-gnu/libQt6Widgets.so.6

I am not that familiar with gdb. If I can provide more info using it, please
give me a hint.

STEPS TO REPRODUCE
Try to quit Smb4K (from master) using either the "Close" button of the main
window (triggering Regression 1) or the "Quit" action (triggering Regression
2).

OBSERVED RESULT
The main window does not hide (Regression 1) or does not exit, but instead
enters an infinite loop (Regression 2).

EXPECTED RESULT
The main window either hides or the application exits.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon Unstable Edition (updated 01-02-2024)
(available in About System)
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 5.249
Qt Version: 6.6.1

ADDITIONAL INFORMATION
Graphics platform is Wayland.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to