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()
{
if (d->graphicsWidget != 0) {
return d->graphicsWidget;
if (d->graphicsWidget) {
return d->graphicsWidget.data();
} else {
return static_cast<Applet*>(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),

View File

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