mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-28 18:50:40 +03:00
dont crash when changing layouts
--occasionaly when the user was switching layouts it could get some crashes. It looks safer to unload first the Latte::Views objects and their corresponding containments afterwards. I tried in my system to switch multiple layouts in plenty different configurations and I could not get a crash. This patch should fix the mentioned crash report if that was the root of the issue. BUG:412864 FIXED-IN:0.9.5
This commit is contained in:
parent
6b5f4a952a
commit
61016444fb
@ -67,23 +67,11 @@ void GenericLayout::unloadContainments()
|
||||
return;
|
||||
}
|
||||
|
||||
//!disconnect signals in order to avoid crashes when the layout is unloading
|
||||
disconnect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRectChanged);
|
||||
disconnect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRegionChanged);
|
||||
disconnect(m_corona->activityConsumer(), &KActivities::Consumer::currentActivityChanged, this, &GenericLayout::updateLastUsedActivity);
|
||||
|
||||
qDebug() << "Layout - " + name() + " unload: containments ... size ::: " << m_containments.size()
|
||||
qDebug() << "Layout - " + name() + " : [unloadContainments]"
|
||||
<< "containments ::: " << m_containments.size()
|
||||
<< " ,latteViews in memory ::: " << m_latteViews.size()
|
||||
<< " ,hidden latteViews in memory ::: " << m_waitingLatteViews.size();
|
||||
|
||||
for (const auto view : m_latteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
for (const auto view : m_waitingLatteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
m_unloadedContainmentsIds.clear();
|
||||
|
||||
QList<Plasma::Containment *> systrays;
|
||||
@ -117,7 +105,23 @@ void GenericLayout::unloadLatteViews()
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Layout - " + name() + " unload: latteViews ... size: " << m_latteViews.size();
|
||||
qDebug() << "Layout - " + name() + " : [unloadLatteViews]"
|
||||
<< "containments ::: " << m_containments.size()
|
||||
<< " ,latteViews in memory ::: " << m_latteViews.size()
|
||||
<< " ,hidden latteViews in memory ::: " << m_waitingLatteViews.size();
|
||||
|
||||
//!disconnect signals in order to avoid crashes when the layout is unloading
|
||||
disconnect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRectChanged);
|
||||
disconnect(this, &GenericLayout::viewsCountChanged, m_corona, &Plasma::Corona::availableScreenRegionChanged);
|
||||
disconnect(m_corona->activityConsumer(), &KActivities::Consumer::currentActivityChanged, this, &GenericLayout::updateLastUsedActivity);
|
||||
|
||||
for (const auto view : m_latteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
for (const auto view : m_waitingLatteViews) {
|
||||
view->disconnectSensitiveSignals();
|
||||
}
|
||||
|
||||
qDeleteAll(m_latteViews);
|
||||
qDeleteAll(m_waitingLatteViews);
|
||||
|
@ -515,8 +515,8 @@ void Synchronizer::unloadCentralLayout(CentralLayout *layout)
|
||||
central->syncToLayoutFile(true);
|
||||
}
|
||||
|
||||
central->unloadContainments();
|
||||
central->unloadLatteViews();
|
||||
central->unloadContainments();
|
||||
|
||||
if (m_multipleModeInitialized) {
|
||||
m_manager->clearUnloadedContainmentsFromLinkedFile(central->unloadedContainmentsIds(), true);
|
||||
@ -533,8 +533,8 @@ void Synchronizer::unloadSharedLayout(SharedLayout *layout)
|
||||
int pos = m_sharedLayouts.indexOf(layout);
|
||||
SharedLayout *shared = m_sharedLayouts.takeAt(pos);
|
||||
shared->syncToLayoutFile(true);
|
||||
shared->unloadContainments();
|
||||
shared->unloadLatteViews();
|
||||
shared->unloadContainments();
|
||||
m_manager->clearUnloadedContainmentsFromLinkedFile(shared->unloadedContainmentsIds(), true);
|
||||
|
||||
delete layout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user