Skip to content

Clean up shutdown process, fix closing too early or not closing at all

Noah Davis requested to merge work/ndavis/shutdown into master

08d23305: Create windows with custom unique_ptrs with deleter via makeUnique()

Windows will be deleted by QWindow::close() instead of default deletion.

884323b7: Add CaptureWindow::instances() and ViewerWindow::instance()

Use these instead of m_viewerWindow and m_captureWindows in SpectacleCore. CaptureWindow::instances() automatically grows and shrinks when capture windows are created or closed. It's too much work to ensure that m_captureWindows only contains unique_ptrs that aren't null after QWindow::close() has been called.

fc2d6251: Use QEventLoopLocker to keep Spectacle alive for notifications

Stopped using setQuitOnLastWindowClosed(false) because setting it true or false depending on the situation was too complex. Now we just create a QEventLoopLocker when we make a notification and destroy the event loop locker, which also automatically quits the application, when the notification is destroyed. To close the windows, we use SpectacleWindow::closeAll() instead of making them hidden. This automatically closes Spectacle when the QEventLoopLocker has not been created.

BUG: 466143 BUG: 450001

44e3fbd4: Don't close Spectacle until the last notification is destroyed

Some notifications can have shorter timeouts and we don't want to close Spectacle before all notifications have expired or been closed.

Edited by Noah Davis

Merge request reports