From 9309fbb978a05ca1bd8ccc760dfe247ff414343f Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 1 Nov 2011 08:47:39 +0000 Subject: [PATCH] Fix memory leak in Video Window on Mac (QTKit) Need to call QTMovie::invalidate before QTMovieView::setMovie to ensure the mmap is deleted before allocating for the new one. This fixes mmap errors when scrolling up and down a list of videos. --- src/DialWindow.cpp | 16 ++++++++++------ src/GcWindowLayout.cpp | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/DialWindow.cpp b/src/DialWindow.cpp index e738e8ede..de3167439 100644 --- a/src/DialWindow.cpp +++ b/src/DialWindow.cpp @@ -46,6 +46,8 @@ DialWindow::DialWindow(MainWindow *mainWindow) : // display label... QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(0); + layout->setContentsMargins(3,3,3,3); valueLabel = new QLabel(this); valueLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); layout->addWidget(valueLabel); @@ -126,13 +128,15 @@ DialWindow::telemetryUpdate(const RealtimeData &rtData) void DialWindow::resizeEvent(QResizeEvent * ) { + // set point size + int size = geometry().height()-15; + if (size <= 0) size = 4; + if (size >= 64) size = 64; - if (geometry().height()-37 < 0) return; - - QFont font; - font.setPointSize((geometry().height()-37)); - font.setWeight(QFont::Bold); - valueLabel->setFont(font); + QFont font; + font.setPointSize(size); + font.setWeight(QFont::Bold); + valueLabel->setFont(font); } void DialWindow::seriesChanged() diff --git a/src/GcWindowLayout.cpp b/src/GcWindowLayout.cpp index f4d227464..90846946e 100644 --- a/src/GcWindowLayout.cpp +++ b/src/GcWindowLayout.cpp @@ -260,8 +260,10 @@ int GcWindowLayout::doLayout(const QRect &rect, bool testOnly) const } // if not in test mode, set updates enabled before we repaint - if (!testOnly) parent->setUpdatesEnabled(true); - parent->repaint(); + if (!testOnly) { + parent->repaint(); + parent->setUpdatesEnabled(true); + } // Return the length of the layout int maxy=0;