From c654019eb945b6b44b2243bb476912ef87a2c35e Mon Sep 17 00:00:00 2001 From: Arjun AK Date: Wed, 30 Jul 2014 18:26:39 +0530 Subject: Prevent multiple connections between sender and receiver Use a Qt::uniqueConnection so that only one connection exists between the sender and receiver. REVIEW: 119532 --- src/panels/places/placesitemmodel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/panels') diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 1f05e07f9..dc2b95c36 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -313,7 +313,8 @@ void PlacesItemModel::requestEject(int index) Solid::OpticalDrive* drive = item->device().parent().as(); if (drive) { connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)), + Qt::UniqueConnection); drive->eject(); } else { const QString label = item->text(); @@ -330,7 +331,8 @@ void PlacesItemModel::requestTeardown(int index) Solid::StorageAccess* access = item->device().as(); if (access) { connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)), + Qt::UniqueConnection); access->teardown(); } } @@ -359,7 +361,8 @@ void PlacesItemModel::requestStorageSetup(int index) m_storageSetupInProgress[access] = index; connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString))); + this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)), + Qt::UniqueConnection); access->setup(); } @@ -598,6 +601,7 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error, { Q_UNUSED(udi); + Q_ASSERT(!m_storageSetupInProgress.isEmpty()); const int index = m_storageSetupInProgress.take(sender()); const PlacesItem* item = placesItem(index); if (!item) { -- cgit v1.3 From a31b836479a1df2138fb4cc295db2f2a4fb97ed8 Mon Sep 17 00:00:00 2001 From: Michael Reeves Date: Sun, 3 Aug 2014 10:48:21 +0200 Subject: Fix warning on launch "QPixmap::scaled: Pixmap is a null pixmap" If Dolphin is launched with the information panel on and set to display previews, PixmapViewer::paintEvent is called three times before any pixmap is set. Each time the above warning message is output. REVIEW: 119553 FIXED-IN: 4.14.0 --- src/panels/information/pixmapviewer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/panels') diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 8a752c587..45a8c17e2 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -102,11 +102,13 @@ void PixmapViewer::paintEvent(QPaintEvent* event) const bool useOldPixmap = (m_transition == SizeTransition) && (m_oldPixmap.width() > m_pixmap.width()); const QPixmap& largePixmap = useOldPixmap ? m_oldPixmap : m_pixmap; - const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth, - scaledHeight, - Qt::IgnoreAspectRatio, - Qt::FastTransformation); - painter.drawPixmap(x, y, scaledPixmap); + if (!largePixmap.isNull()) { + const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth, + scaledHeight, + Qt::IgnoreAspectRatio, + Qt::FastTransformation); + painter.drawPixmap(x, y, scaledPixmap); + } } else { const int x = (width() - m_pixmap.width() ) / 2; const int y = (height() - m_pixmap.height()) / 2; -- cgit v1.3