1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-27 06:03:51 +03:00

improve recreate dock implementation

--the new implementation possibly fixes two crashes
that could occur occasionaly. First it is ensured
that the new dock in created after the old one has been
removed. We also use directly the containment instead
of using a reference for it which could create a crash
in some cases. One more fix, setting dock visible to false
had no reason as long as it is going to be deleted either
way.
This commit is contained in:
Michail Vourlakos 2017-06-23 10:54:35 +03:00
parent 69c28eff7a
commit 0bd90b8fd2

View File

@ -931,14 +931,23 @@ void DockCorona::addDock(Plasma::Containment *containment, int expDockScreen)
void DockCorona::recreateDock(Plasma::Containment *containment)
{
//give the time to config window to close itself first and then recreate the dock
//! give the time to config window to close itself first and then recreate the dock
//! step:1 remove the dockview
QTimer::singleShot(350, [this, containment]() {
auto view = m_dockViews.take(containment);
if (view) {
view->setVisible(false);
qDebug() << "recreate - step 1: removing dock for containment:" << containment->id();
view->deleteLater();
addDock(view->containment());
//! step:2 add the new dockview
QTimer::singleShot(250, [this, containment]() {
if (!m_dockViews.contains(containment)) {
qDebug() << "recreate - step 2: adding dock for containment:" << containment->id();
addDock(containment);
}
});
}
});
}