diff options
author | Mustafa Quraish <mustafaq9@gmail.com> | 2022-01-04 20:20:01 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-05 12:08:20 +0100 |
commit | 8c4579bced8cad0d368432239264526917ed7e42 (patch) | |
tree | ca1d48f9f4b287758ecc8667b1c67b9c0518a00b /Userland | |
parent | 2440d2c2fe9488af0888cd6854a902c47dfad159 (diff) | |
download | serenity-8c4579bced8cad0d368432239264526917ed7e42.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/PixelPaint/MainWidget.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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) { |