protect with a weak pointer

BUG:268752
This commit is contained in:
Aaron Seigo 2011-03-17 16:46:35 +01:00
parent e637d4268f
commit 3e3bfe89b0
2 changed files with 5 additions and 5 deletions

View File

@ -478,8 +478,8 @@ void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
//set mousePos to the position in the applet, in screencoords, so it becomes easy
//to reposition the toplevel view to the correct position.
if (m_currentView && m_applet) {
QPoint localpos = m_currentView->mapFromScene(m_applet->scenePos());
m_mousePos = event->screenPos() - m_currentView->mapToGlobal(localpos);
QPoint localpos = m_currentView.data()->mapFromScene(m_applet->scenePos());
m_mousePos = event->screenPos() - m_currentView.data()->mapToGlobal(localpos);
}
return;
}
@ -494,7 +494,7 @@ bool AppletHandle::leaveCurrentView(const QPoint &pos) const
//is this widget a plasma view, a different view then our current one,
//AND not a dashboardview?
Plasma::View *v = qobject_cast<Plasma::View *>(widget);
if (v && v != m_currentView && v->containment() != m_containment) {
if (v && v != m_currentView.data() && v->containment() != m_containment) {
return true;
}
}
@ -616,7 +616,7 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (m_pressedButton == MoveButton) {
if (leaveCurrentView(event->screenPos())) {
Plasma::View *v = Plasma::View::topLevelViewAt(event->screenPos());
if (v && v != m_currentView) {
if (v && v != m_currentView.data()) {
Containment *c = v->containment();
if (c) {
QPoint pos = v->mapFromGlobal(event->screenPos());

View File

@ -125,7 +125,7 @@ class AppletHandle : public QGraphicsObject
QTimer *m_hoverTimer;
QTimer *m_leaveTimer;
QPixmap *m_backgroundBuffer;
QGraphicsView *m_currentView;
QWeakPointer<QGraphicsView> m_currentView;
Svg *m_configureIcons;
FrameSvg *m_background;