changeset 32164:4264d00146bb

file editor: Reset wait cursor also when loading file fails (bug #64330). * libgui/src/m-editor/file-editor-tab.cc (file_editor_tab::load_file): Use unwind_action to restore the previous mouse pointer when loading file.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 23 Jun 2023 19:44:00 +0200
parents 3815dfaf27e3
children 98c550c374ef
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Fri Jun 23 16:20:33 2023 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Fri Jun 23 19:44:00 2023 +0200
@@ -1861,6 +1861,8 @@
     }
 
   QApplication::setOverrideCursor (Qt::WaitCursor);
+  unwind_action reset_cursor ([] ()
+                              { QApplication::restoreOverrideCursor (); });
 
   // read the file binary, decoding later
   QByteArray text_data = file.readAll ();
@@ -1956,8 +1958,6 @@
   m_edit_area->setText (text);
   m_edit_area->setEolMode (detect_eol_mode ());
 
-  QApplication::restoreOverrideCursor ();
-
   m_copy_available = false;  // no selection yet available
   m_edit_area->setModified (false);  // loaded file is not modified yet
   set_file_name (file_to_load);