[kde-doc-english] [trojita] src/Gui: GUI: fix segfault in the FindBar dismissal

Jan Kundrát jkt at flaska.net
Mon Mar 11 17:50:48 UTC 2013


Git commit d9c9bf6333fb5fe0c820e558700ea84d32542b35 by Jan Kundrát.
Committed on 11/03/2013 at 18:40.
Pushed by jkt into branch 'master'.

GUI: fix segfault in the FindBar dismissal

Because the underlying QWebView can be deleted more or less any time (for
example as a result of the user navigating away to another message), it is
really bad idea to keep it around indefinitely.

There was a reproducible segfault:
- open a message
- press ctrl+f, type something to execute a search
- navigate to another message
- dismiss the find bar

Nothing more besides using a guarded pointer is actually needed here; the checks
appear to be placed in all entry points already.

M  +2    -1    src/Gui/FindBar.h

http://commits.kde.org/trojita/d9c9bf6333fb5fe0c820e558700ea84d32542b35

diff --git a/src/Gui/FindBar.h b/src/Gui/FindBar.h
index 2e88b03..8e77d01 100644
--- a/src/Gui/FindBar.h
+++ b/src/Gui/FindBar.h
@@ -28,6 +28,7 @@
 #ifndef GUI_FINDBAR_H
 #define GUI_FINDBAR_H
 
+#include <QPointer>
 #include <QWidget>
 
 class QCheckBox;
@@ -70,7 +71,7 @@ private:
     QCheckBox *m_highlightAll;
 
     QString _lastStringSearched;
-    QWebView *m_associatedWebView;
+    QPointer<QWebView> m_associatedWebView;
 };
 
 }



More information about the kde-doc-english mailing list