diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 59756d8693..f7ab853905 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -187,8 +187,7 @@ QBitmap::QBitmap(const QString& fileName, const char *format) QBitmap &QBitmap::operator=(const QPixmap &pixmap) { if (pixmap.isNull()) { // a null pixmap - QBitmap bm(0, 0); - QBitmap::operator=(bm); + QBitmap(0, 0).swap(*this); } else if (pixmap.depth() == 1) { // 1-bit pixmap QPixmap::operator=(pixmap); // shallow assignment } else { // n-bit depth pixmap diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index b16ae2ffce..71ec636839 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -983,7 +983,7 @@ QImage::QImage(const QImage &image) { if (image.paintingActive() || isLocked(image.d)) { d = 0; - operator=(image.copy()); + image.copy().swap(*this); } else { d = image.d; if (d) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 183c13698a..c1a63f5101 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -226,7 +226,7 @@ QPixmap::QPixmap(const QPixmap &pixmap) return; } if (pixmap.paintingActive()) { // make a deep copy - operator=(pixmap.copy()); + pixmap.copy().swap(*this); } else { data = pixmap.data; } @@ -384,7 +384,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap) return *this; } if (pixmap.paintingActive()) { // make a deep copy - *this = pixmap.copy(); + pixmap.copy().swap(*this); } else { data = pixmap.data; }