MainWindow, View::View: Fix two memory errors reported by valgrind
authorPerttu Ahola <celeron55@iki.fi>
Sat, 24 Dec 2016 19:31:05 +0000 (21:31 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Mon, 26 Dec 2016 17:58:05 +0000 (18:58 +0100)
(use of freed data, use of uninitialized variable)

pv/mainwindow.cpp
pv/view/view.cpp

index f7c47122737216fba1fa32472d70f10cf6b5b71c..d65537483c8f1a19bd91e6ccd93dee7014b80bfc 100644 (file)
@@ -280,8 +280,9 @@ void MainWindow::remove_session(shared_ptr<Session> session)
                                // that Qt keeps a pointer to the view around
                                entry.second->setParent(0);
 
-                               // Remove this entry from the container
+                               // Remove this entry from the container and stop iterating.
                                view_docks_.erase(entry.first);
+                               break;
                        }
        }
 
index a086d23de523f07e2be1192cbfc3b4bd2a028b09..9751f008df79f75cee62bfeadc77d9c48111ce96 100644 (file)
@@ -155,7 +155,8 @@ View::View(Session &session, QWidget *parent) :
        cursors_(new CursorPair(*this)),
        next_flag_text_('A'),
        trigger_markers_(),
-       hover_point_(-1, -1)
+       hover_point_(-1, -1),
+       scroll_needs_defaults(false)
 {
        connect(scrollarea_.horizontalScrollBar(), SIGNAL(valueChanged(int)),
                this, SLOT(h_scroll_value_changed(int)));