From 8c4579bced8cad0d368432239264526917ed7e42 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Tue, 4 Jan 2022 20:20:01 -0500 Subject: PixelPaint: Only prompt for unsaved changes if there any Previously MainWidget::request_close() would always put up the message box asking to save unsaved changes, even if there aren't any. This patch makes it so that the message box is only shown if the undo stack is in a modified state. --- Userland/Applications/PixelPaint/MainWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Userland') diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 8f987bbb21..19a03b1f72 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -755,6 +755,10 @@ bool MainWidget::request_close() VERIFY(current_image_editor()); + if (!current_image_editor()->undo_stack().is_current_modified()) { + return true; + } + auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), current_image_editor()->path(), current_image_editor()->undo_stack().last_unmodified_timestamp()); if (result == GUI::MessageBox::ExecYes) { -- cgit v1.2.3