Keep notification QObjects out of the ListModels to stop shell crashes

Model rows stored the live Notification object in a ref role. When the
server destroyed the notification (sender close, DND untrack, dismiss)
the role became a dangling C++ pointer, and the next read segfaulted in
QQmlListModel::data — typically when replaying history over IPC. Track
live notifications in a JS map keyed by originalId instead, cleaned up
on close and untrack, where a stale reference degrades to a catchable
error instead of a crash.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-22 21:39:15 -07:00
co-authored by Claude Fable 5
parent fc6168af86
commit 70f18e9a1c
2 changed files with 32 additions and 12 deletions
@@ -73,8 +73,7 @@ function snapshotOf(notification, timestamp) {
glyph: glyphFromHints(n.hints),
urgency: n.urgency,
expireTimeout: expireTimeout,
timestamp: timestamp === undefined ? Date.now() : timestamp,
ref: notification
timestamp: timestamp === undefined ? Date.now() : timestamp
}
}
@@ -91,8 +90,7 @@ function historyEntry(value, normalUrgency) {
glyph: e.glyph || "",
urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency,
expireTimeout: 0,
timestamp: e.timestamp || 0,
ref: null
timestamp: e.timestamp || 0
}
}