mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(notifications): defer Loader activation to prevent re-entrant incubation SIGSEGV
This commit is contained in:
@@ -28,8 +28,13 @@ Variants {
|
||||
|
||||
property ListModel notificationModel: NotificationService.activeList
|
||||
|
||||
// Always create window (but with 0x0 dimensions when no notifications)
|
||||
active: notificationModel.count > 0 || delayTimer.running
|
||||
// Deferred activation to prevent re-entrant QML incubation crash.
|
||||
// Direct binding to notificationModel.count would activate the Loader
|
||||
// synchronously during ListModel.insert(), causing nested incubation
|
||||
// (Loader + inner Repeater both processing the model) which crashes
|
||||
// the V4 engine in QV4::Object::insertMember.
|
||||
property bool shouldBeActive: false
|
||||
active: shouldBeActive || delayTimer.running
|
||||
|
||||
// Keep loader active briefly after last notification to allow animations to complete
|
||||
Timer {
|
||||
@@ -38,10 +43,23 @@ Variants {
|
||||
repeat: false
|
||||
}
|
||||
|
||||
// Deferred activation timer - activates Loader on next event loop iteration
|
||||
Timer {
|
||||
id: activationTimer
|
||||
interval: 0
|
||||
repeat: false
|
||||
onTriggered: root.shouldBeActive = true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: notificationModel
|
||||
function onCountChanged() {
|
||||
if (notificationModel.count === 0 && root.active) {
|
||||
if (notificationModel.count > 0) {
|
||||
if (!root.shouldBeActive) {
|
||||
activationTimer.restart();
|
||||
}
|
||||
} else if (root.shouldBeActive) {
|
||||
root.shouldBeActive = false;
|
||||
delayTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user