From 9775682bef4dbe7bd74d2ef993730a4bcfb634f5 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Tue, 22 Nov 2011 13:29:02 +0100 Subject: [PATCH] use a QWeakPointer with the graphics widget handed in as we don't own it --- popupapplet.cpp | 5 ++--- private/popupapplet_p.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index 116d0a12a..c35419f59 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -160,8 +160,8 @@ void PopupApplet::setWidget(QWidget *widget) QGraphicsWidget *PopupApplet::graphicsWidget() { - if (d->graphicsWidget != 0) { - return d->graphicsWidget; + if (d->graphicsWidget) { + return d->graphicsWidget.data(); } else { return static_cast(this)->d->extender.data(); } @@ -668,7 +668,6 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet) : q(applet), icon(0), widget(0), - graphicsWidget(0), popupPlacement(Plasma::FloatingPopup), popupAlignment(Qt::AlignLeft), savedAspectRatio(Plasma::InvalidAspectRatioMode), diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index eab42c32d..5bcede470 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -55,7 +55,7 @@ public: QWeakPointer dialogPtr; QWeakPointerproxy; QWidget *widget; - QGraphicsWidget *graphicsWidget; + QWeakPointer graphicsWidget; Plasma::PopupPlacement popupPlacement; Qt::AlignmentFlag popupAlignment; Plasma::AspectRatioMode savedAspectRatio;