use weakpointer, hopefully a crash less
svn path=/trunk/KDE/kdelibs/; revision=1035683
This commit is contained in:
parent
1a34a05a9d
commit
7fb7eefa8b
@ -559,7 +559,7 @@ void AppletPrivate::positionMessageOverlay()
|
||||
|
||||
if (usePopup && popup->widget()) {
|
||||
// popupapplet with widget()
|
||||
topItem = popup->d->proxy;
|
||||
topItem = popup->d->proxy.data();
|
||||
messageOverlay->setGeometry(popup->widget()->contentsRect());
|
||||
} else if (usePopup && popup->graphicsWidget() && popup->graphicsWidget() != extender) {
|
||||
// popupapplet with graphicsWidget()
|
||||
|
@ -139,7 +139,7 @@ void PopupApplet::setWidget(QWidget *widget)
|
||||
lay->removeWidget(d->widget);
|
||||
lay->addWidget(widget);
|
||||
} else if (d->proxy) {
|
||||
d->proxy->setWidget(widget);
|
||||
d->proxy.data()->setWidget(widget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,9 +274,8 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
||||
|
||||
if (gWidget) {
|
||||
if (proxy) {
|
||||
proxy->setWidget(0);
|
||||
delete proxy;
|
||||
proxy = 0;
|
||||
proxy.data()->setWidget(0);
|
||||
delete proxy.data();
|
||||
}
|
||||
|
||||
Corona *corona = qobject_cast<Corona *>(gWidget->scene());
|
||||
@ -290,11 +289,11 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
||||
} else if (qWidget) {
|
||||
if (!proxy) {
|
||||
proxy = new QGraphicsProxyWidget(q);
|
||||
proxy->setWidget(qWidget);
|
||||
proxy->show();
|
||||
proxy.data()->setWidget(qWidget);
|
||||
proxy.data()->show();
|
||||
}
|
||||
|
||||
lay->addItem(proxy);
|
||||
lay->addItem(proxy.data());
|
||||
prefSize = qWidget->sizeHint();
|
||||
}
|
||||
|
||||
@ -327,9 +326,8 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
||||
}
|
||||
|
||||
if (proxy) {
|
||||
proxy->setWidget(0); // prevent it from deleting our widget!
|
||||
delete proxy;
|
||||
proxy = 0;
|
||||
proxy.data()->setWidget(0); // prevent it from deleting our widget!
|
||||
delete proxy.data();
|
||||
}
|
||||
|
||||
if (!dialog) {
|
||||
@ -551,7 +549,6 @@ bool PopupApplet::isPopupShowing() const
|
||||
PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
|
||||
: q(applet),
|
||||
icon(0),
|
||||
proxy(0),
|
||||
widget(0),
|
||||
graphicsWidget(0),
|
||||
popupPlacement(Plasma::FloatingPopup),
|
||||
@ -565,7 +562,7 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
|
||||
PopupAppletPrivate::~PopupAppletPrivate()
|
||||
{
|
||||
if (proxy) {
|
||||
proxy->setWidget(0);
|
||||
proxy.data()->setWidget(0);
|
||||
}
|
||||
|
||||
delete dialog.data();
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef POPUPAPPLET_P_H
|
||||
#define POPUPAPPLET_P_H
|
||||
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include <plasma/plasma.h>
|
||||
|
||||
namespace Plasma
|
||||
@ -43,7 +45,7 @@ public:
|
||||
PopupApplet *q;
|
||||
Plasma::IconWidget *icon;
|
||||
QWeakPointer<Plasma::Dialog> dialog;
|
||||
QGraphicsProxyWidget *proxy;
|
||||
QWeakPointer<QGraphicsProxyWidget>proxy;
|
||||
QWidget *widget;
|
||||
QGraphicsWidget *graphicsWidget;
|
||||
Plasma::PopupPlacement popupPlacement;
|
||||
|
Loading…
Reference in New Issue
Block a user