From f420385094dc7392e6bcec494d800f1d4b34f082 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 24 Dec 2016 21:31:05 +0200 Subject: [PATCH] MainWindow, View::View: Fix two memory errors reported by valgrind (use of freed data, use of uninitialized variable) --- pv/mainwindow.cpp | 3 ++- pv/view/view.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index f7c47122..d6553748 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 a086d23d..9751f008 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))); -- 2.30.2