mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Possibly fix a crash in the EventDelegateChooser
This commit is contained in:
parent
78fac7dced
commit
071578923d
2 changed files with 18 additions and 8 deletions
|
@ -269,7 +269,7 @@ EventDelegateChooser::DelegateIncubator::statusChanged(QQmlIncubator::Status sta
|
|||
}
|
||||
|
||||
child->setParentItem(&chooser);
|
||||
QQmlEngine::setObjectOwnership(child, QQmlEngine::ObjectOwnership::JavaScriptOwnership);
|
||||
QQmlEngine::setObjectOwnership(child, QQmlEngine::ObjectOwnership::CppOwnership);
|
||||
|
||||
// connect(child, &QQuickItem::parentChanged, child, [child](QQuickItem *) {
|
||||
// // QTBUG-115687
|
||||
|
|
|
@ -989,8 +989,11 @@ TimelineModel::data(const QModelIndex &index, int role) const
|
|||
void
|
||||
TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const
|
||||
{
|
||||
if (index.row() < 0 && index.row() >= rowCount())
|
||||
if (index.row() < 0 && index.row() >= rowCount()) {
|
||||
for (QModelRoleData &roleData : roleDataSpan)
|
||||
roleData.clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
// HACK(Nico): fetchMore likes to break with dynamically sized delegates and reuseItems
|
||||
if (index.row() + 1 == rowCount() && !m_paginationInProgress)
|
||||
|
@ -998,13 +1001,14 @@ TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSp
|
|||
|
||||
auto event = events.get(rowCount() - index.row() - 1);
|
||||
|
||||
if (!event)
|
||||
if (!event) {
|
||||
for (QModelRoleData &roleData : roleDataSpan)
|
||||
roleData.clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
for (QModelRoleData &roleData : roleDataSpan) {
|
||||
int role = roleData.role();
|
||||
|
||||
roleData.setData(data(*event, role));
|
||||
roleData.setData(data(*event, roleData.role()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1013,13 +1017,19 @@ TimelineModel::multiData(const QString &id,
|
|||
const QString &relatedTo,
|
||||
QModelRoleDataSpan roleDataSpan) const
|
||||
{
|
||||
if (id.isEmpty())
|
||||
if (id.isEmpty()) {
|
||||
for (QModelRoleData &roleData : roleDataSpan)
|
||||
roleData.clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
auto event = events.get(id.toStdString(), relatedTo.toStdString());
|
||||
|
||||
if (!event)
|
||||
if (!event) {
|
||||
for (QModelRoleData &roleData : roleDataSpan)
|
||||
roleData.clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
for (QModelRoleData &roleData : roleDataSpan) {
|
||||
int role = roleData.role();
|
||||
|
|
Loading…
Reference in a new issue