crash--
This commit is contained in:
parent
3184551ddb
commit
f692b5aa74
@ -151,7 +151,13 @@ void DataSource::dataUpdated(const QString &sourceName, const Plasma::DataEngine
|
||||
|
||||
void DataSource::modelChanged(const QString &sourceName, QAbstractItemModel *model)
|
||||
{
|
||||
if (!model) {
|
||||
m_models->clear(sourceName);
|
||||
return;
|
||||
}
|
||||
|
||||
m_models->insert(sourceName, QVariant::fromValue(model));
|
||||
//FIXME: this will break in the case a second model is set
|
||||
connect(model, &QObject::destroyed, [=]() {
|
||||
m_models->clear(sourceName);
|
||||
});
|
||||
|
@ -380,6 +380,12 @@ void DataContainer::timerEvent(QTimerEvent * event)
|
||||
if (!isUsed()) {
|
||||
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
|
||||
//qDebug() << objectName() << "is unused";
|
||||
|
||||
//NOTE: Notifying visualization of the model destruction before actual deletion avoids crashes in some edge cases
|
||||
if (d->model) {
|
||||
d->model.clear();
|
||||
emit modelChanged(objectName(), 0);
|
||||
}
|
||||
emit becameUnused(objectName());
|
||||
}
|
||||
d->checkUsageTimer.stop();
|
||||
|
Loading…
Reference in New Issue
Block a user