fix crashes: wrong containment deletion/signals

--we fix two crashes, one from availableScreenRectChanged
signaling when we unload a layout
--one from deleting containments in random order,
we must first delete systrays and then the rest containments
pull/2/head
Michail Vourlakos 7 years ago
parent f617a9178e
commit 822f3630ac

@ -299,6 +299,15 @@ void DockView::initSignalingForLocationChangeSliding()
});
}
void DockView::disconnectSensitiveSignals()
{
disconnect(corona(), &Plasma::Corona::availableScreenRectChanged, this, &DockView::availableScreenRectChanged);
if (visibility()) {
visibility()->setEnabledDynamicBackground(false);
}
}
void DockView::availableScreenRectChanged()
{
if (m_inDelete)

@ -181,6 +181,10 @@ public:
static QScreen *atScreens(QQmlListProperty<QScreen> *property, int index);
void reconsiderScreen();
//! these are signals that create crashes, such a example is the availableScreenRectChanged from corona
//! when its containment is destroyed
void disconnectSensitiveSignals();
public slots:
Q_INVOKABLE void addNewDock();
Q_INVOKABLE void removeDock();

@ -64,6 +64,30 @@ void Layout::unloadContainments()
qDebug() << "Layout - " + name() + " unload: containments ... size: " << m_containments.size();
foreach (auto view, m_dockViews) {
view->disconnectSensitiveSignals();
}
foreach (auto view, m_waitingDockViews) {
view->disconnectSensitiveSignals();
}
QList<Plasma::Containment *> systrays;
//!identify systrays and unload them first
foreach (auto containment, m_containments) {
if (Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent())) {
systrays.append(containment);
}
}
while (!systrays.isEmpty()) {
Plasma::Containment *systray = systrays.at(0);
systrays.removeFirst();
m_containments.removeAll(systray);
delete systray;
}
while (!m_containments.isEmpty()) {
Plasma::Containment *containment = m_containments.at(0);
m_containments.removeFirst();

Loading…
Cancel
Save