protect with a weak pointer
BUG:268752
This commit is contained in:
parent
e637d4268f
commit
3e3bfe89b0
@ -478,8 +478,8 @@ void AppletHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
//set mousePos to the position in the applet, in screencoords, so it becomes easy
|
//set mousePos to the position in the applet, in screencoords, so it becomes easy
|
||||||
//to reposition the toplevel view to the correct position.
|
//to reposition the toplevel view to the correct position.
|
||||||
if (m_currentView && m_applet) {
|
if (m_currentView && m_applet) {
|
||||||
QPoint localpos = m_currentView->mapFromScene(m_applet->scenePos());
|
QPoint localpos = m_currentView.data()->mapFromScene(m_applet->scenePos());
|
||||||
m_mousePos = event->screenPos() - m_currentView->mapToGlobal(localpos);
|
m_mousePos = event->screenPos() - m_currentView.data()->mapToGlobal(localpos);
|
||||||
}
|
}
|
||||||
return;
|
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,
|
//is this widget a plasma view, a different view then our current one,
|
||||||
//AND not a dashboardview?
|
//AND not a dashboardview?
|
||||||
Plasma::View *v = qobject_cast<Plasma::View *>(widget);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
if (m_pressedButton == MoveButton) {
|
if (m_pressedButton == MoveButton) {
|
||||||
if (leaveCurrentView(event->screenPos())) {
|
if (leaveCurrentView(event->screenPos())) {
|
||||||
Plasma::View *v = Plasma::View::topLevelViewAt(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();
|
Containment *c = v->containment();
|
||||||
if (c) {
|
if (c) {
|
||||||
QPoint pos = v->mapFromGlobal(event->screenPos());
|
QPoint pos = v->mapFromGlobal(event->screenPos());
|
||||||
|
@ -125,7 +125,7 @@ class AppletHandle : public QGraphicsObject
|
|||||||
QTimer *m_hoverTimer;
|
QTimer *m_hoverTimer;
|
||||||
QTimer *m_leaveTimer;
|
QTimer *m_leaveTimer;
|
||||||
QPixmap *m_backgroundBuffer;
|
QPixmap *m_backgroundBuffer;
|
||||||
QGraphicsView *m_currentView;
|
QWeakPointer<QGraphicsView> m_currentView;
|
||||||
|
|
||||||
Svg *m_configureIcons;
|
Svg *m_configureIcons;
|
||||||
FrameSvg *m_background;
|
FrameSvg *m_background;
|
||||||
|
Loading…
Reference in New Issue
Block a user