From: Perttu Ahola Date: Sat, 24 Dec 2016 19:31:05 +0000 (+0200) Subject: MainWindow, View::View: Fix two memory errors reported by valgrind X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=commitdiff_plain;h=f420385094dc7392e6bcec494d800f1d4b34f082 MainWindow, View::View: Fix two memory errors reported by valgrind (use of freed data, use of uninitialized variable) --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index f7c4712..d655374 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -280,8 +280,9 @@ void MainWindow::remove_session(shared_ptr 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; } } diff --git a/pv/view/view.cpp b/pv/view/view.cpp index a086d23..9751f00 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -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)));