Commit 508a1da0 authored by Thomas Lübking's avatar Thomas Lübking
Browse files

keep + track m_closeWindow to keep m_winData alive

BUG: 259640
FIXED-IN: 4.10.2
REVIEW: 109509
parent b843da6e
......@@ -65,6 +65,7 @@ PresentWindowsEffect::PresentWindowsEffect()
, m_highlightedWindow(NULL)
, m_filterFrame(NULL)
, m_closeView(NULL)
, m_closeWindow(NULL)
, m_dragInProgress(false)
, m_dragWindow(NULL)
, m_highlightedDropTarget(NULL)
......@@ -201,7 +202,7 @@ void PresentWindowsEffect::postPaintScreen()
{
if (m_motionManager.areWindowsMoving())
effects->addRepaintFull();
else if (!m_activated && m_motionManager.managingWindows()) {
else if (!m_activated && m_motionManager.managingWindows() && !m_closeWindow) {
// We have finished moving them back, stop processing
m_motionManager.unmanageAll();
......@@ -245,7 +246,7 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d
{
// TODO: We should also check to see if any windows are fading just in case fading takes longer
// than moving the windows when the effect is deactivated.
if (m_activated || m_motionManager.areWindowsMoving()) {
if (m_activated || m_motionManager.areWindowsMoving() || m_closeWindow) {
DataHash::iterator winData = m_windowData.find(w);
if (winData == m_windowData.end()) {
effects->prePaintWindow(w, data, time);
......@@ -290,6 +291,9 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d
// we have to keep the window in the list to prevent flickering
winData->referenced = false;
w->unrefWindow();
if (w == m_closeWindow) {
m_closeWindow = NULL;
}
} else
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
}
......@@ -421,6 +425,15 @@ void PresentWindowsEffect::slotWindowAdded(EffectWindow *w)
rearrangeWindows();
}
if (m_closeView && w == effects->findWindow(m_closeView->winId())) {
if (m_closeWindow != w) {
DataHash::iterator winDataIt = m_windowData.find(m_closeWindow);
if (winDataIt != m_windowData.end()) {
if (winDataIt->referenced) {
m_closeWindow->unrefWindow();
}
m_windowData.erase(winDataIt);
}
}
winData->visible = true;
winData->highlight = 1.0;
m_closeWindow = w;
......@@ -436,13 +449,14 @@ void PresentWindowsEffect::slotWindowClosed(EffectWindow *w)
if (winData == m_windowData.end())
return;
winData->deleted = true;
winData->referenced = true;
w->refWindow();
if (!winData->referenced) {
winData->referenced = true;
w->refWindow();
}
if (m_highlightedWindow == w)
setHighlightedWindow(findFirstWindow());
if (m_closeWindow == w) {
m_closeWindow = 0;
return; // don't rearrange
return; // don't rearrange, get's nulled when unref'd
}
rearrangeWindows();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment