From 13cbcff097c6bba874b424c881cf914e33cd012e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 24 Jan 2014 10:02:35 +0100 Subject: [PATCH] Windows: Remove unused function QWindowsBackingStore::rasterWindow(). It was only used to access the QWindow which can be retrieved using QPlatformBackingStore::window(), potentially causing a crash when QWindowsBackingStore::resize() was called before the window is shown. Change-Id: I7c1bfce0f2c371d5d8847fd15fd1dc760b769a8f Reviewed-by: Oliver Wolff --- .../platforms/windows/qwindowsbackingstore.cpp | 12 ++---------- src/plugins/platforms/windows/qwindowsbackingstore.h | 2 -- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 1dd22c620b..f12c828d8a 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -141,12 +141,12 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) #ifndef QT_NO_DEBUG_OUTPUT if (QWindowsContext::verbose && lcQpaBackingStore().isDebugEnabled()) { qCDebug(lcQpaBackingStore) - << __FUNCTION__ << ' ' << rasterWindow()->window() << ' ' << size << ' ' << region + << __FUNCTION__ << ' ' << window() << ' ' << size << ' ' << region << " from: " << (m_image.isNull() ? QSize() : m_image->image().size()); } #endif QImage::Format format = QWindowsNativeImage::systemFormat(); - if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) + if (format == QImage::Format_RGB32 && window()->format().hasAlpha()) format = QImage::Format_ARGB32_Premultiplied; QWindowsNativeImage *oldwni = m_image.data(); @@ -196,14 +196,6 @@ void QWindowsBackingStore::beginPaint(const QRegion ®ion) } } -QWindowsWindow *QWindowsBackingStore::rasterWindow() const -{ - if (const QWindow *w = window()) - if (QPlatformWindow *pw = w->handle()) - return static_cast(pw); - return 0; -} - HDC QWindowsBackingStore::getDC() const { if (!m_image.isNull()) diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index d50570dd2c..b655aca835 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -68,8 +68,6 @@ public: HDC getDC() const; private: - QWindowsWindow *rasterWindow() const; - QScopedPointer m_image; };