use a QWeakPointer with the graphics widget handed in as we don't own it

This commit is contained in:
Aaron Seigo 2011-11-22 13:29:02 +01:00
parent d47a6bf33b
commit 9775682bef
2 changed files with 3 additions and 4 deletions

View File

@ -160,8 +160,8 @@ void PopupApplet::setWidget(QWidget *widget)
QGraphicsWidget *PopupApplet::graphicsWidget() QGraphicsWidget *PopupApplet::graphicsWidget()
{ {
if (d->graphicsWidget != 0) { if (d->graphicsWidget) {
return d->graphicsWidget; return d->graphicsWidget.data();
} else { } else {
return static_cast<Applet*>(this)->d->extender.data(); return static_cast<Applet*>(this)->d->extender.data();
} }
@ -668,7 +668,6 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
: q(applet), : q(applet),
icon(0), icon(0),
widget(0), widget(0),
graphicsWidget(0),
popupPlacement(Plasma::FloatingPopup), popupPlacement(Plasma::FloatingPopup),
popupAlignment(Qt::AlignLeft), popupAlignment(Qt::AlignLeft),
savedAspectRatio(Plasma::InvalidAspectRatioMode), savedAspectRatio(Plasma::InvalidAspectRatioMode),

View File

@ -55,7 +55,7 @@ public:
QWeakPointer<Plasma::Dialog> dialogPtr; QWeakPointer<Plasma::Dialog> dialogPtr;
QWeakPointer<QGraphicsProxyWidget>proxy; QWeakPointer<QGraphicsProxyWidget>proxy;
QWidget *widget; QWidget *widget;
QGraphicsWidget *graphicsWidget; QWeakPointer<QGraphicsWidget> graphicsWidget;
Plasma::PopupPlacement popupPlacement; Plasma::PopupPlacement popupPlacement;
Qt::AlignmentFlag popupAlignment; Qt::AlignmentFlag popupAlignment;
Plasma::AspectRatioMode savedAspectRatio; Plasma::AspectRatioMode savedAspectRatio;