[kde-doc-english] [trojita] src/Gui: GUI: do not interfere with saved sizes when restoring geometry

Jan Kundrát jkt at flaska.net
Thu Aug 22 10:45:16 UTC 2013


Git commit 9c1051973e22a42cc97e8b94d4908464dbe664f8 by Jan Kundrát.
Committed on 21/08/2013 at 05:23.
Pushed by jkt into branch 'master'.

GUI: do not interfere with saved sizes when restoring geometry

restoreGeometry() and restoreState() manipulate sizes and state of certain
widgets, and there are slots connected to signals which these widgets emit
which, in the end, lead to updating the saved state on disk, which is a wrong
thing to do here.

CCBUG: 323715

M  +7    -0    src/Gui/Window.cpp

http://commits.kde.org/trojita/9c1051973e22a42cc97e8b94d4908464dbe664f8

diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 800a49e..1582438 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -2320,6 +2320,11 @@ void MainWindow::applySizesAndState()
     stream >> size;
     QByteArray item;
 
+    // There are slots connected to various events triggered by both restoreGeometry() and restoreState() which would attempt to
+    // save our geometries and state, which is what we must avoid while this method is executing.
+    bool skipSaving = m_skipSavingOfUI;
+    m_skipSavingOfUI = true;
+
     if (size-- && !stream.atEnd()) {
         stream >> item;
         restoreGeometry(item);
@@ -2375,6 +2380,8 @@ void MainWindow::applySizesAndState()
             }
         }
     }
+
+    m_skipSavingOfUI = skipSaving;
 }
 
 void MainWindow::resizeEvent(QResizeEvent *)



More information about the kde-doc-english mailing list