mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(hyprland): same fix but with a simpler Qt.callLater approach
This commit is contained in:
@@ -32,21 +32,13 @@ Item {
|
|||||||
onTriggered: safeUpdate()
|
onTriggered: safeUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Coalesces workspace updates: onRawEvent calls refreshWorkspaces() which
|
// Deferred via Qt.callLater to coalesce workspace updates: onRawEvent calls
|
||||||
// triggers onValuesChanged synchronously in the same call stack, then
|
// refreshWorkspaces() which triggers onValuesChanged synchronously in the
|
||||||
// onRawEvent itself also restarts this timer — without deferral the
|
// same call stack — without deferral the ListModel gets cleared+repopulated
|
||||||
// ListModel gets cleared+repopulated twice per event. The timer coalesces
|
// twice per event. Qt.callLater deduplicates by function identity.
|
||||||
// these into a single update and avoids synchronous ListModel mutations
|
function _deferredWorkspaceUpdate() {
|
||||||
// during signal cascades that can crash the V4 engine (SIGSEGV in
|
safeUpdateWorkspaces();
|
||||||
// QV4::Object::insertMember).
|
workspaceChanged();
|
||||||
Timer {
|
|
||||||
id: workspaceUpdateTimer
|
|
||||||
interval: 0
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
safeUpdateWorkspaces();
|
|
||||||
workspaceChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
@@ -488,7 +480,7 @@ Item {
|
|||||||
target: Hyprland.workspaces
|
target: Hyprland.workspaces
|
||||||
enabled: initialized
|
enabled: initialized
|
||||||
function onValuesChanged() {
|
function onValuesChanged() {
|
||||||
workspaceUpdateTimer.restart();
|
Qt.callLater(_deferredWorkspaceUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,10 +498,10 @@ Item {
|
|||||||
function onRawEvent(event) {
|
function onRawEvent(event) {
|
||||||
Hyprland.refreshWorkspaces();
|
Hyprland.refreshWorkspaces();
|
||||||
Hyprland.refreshToplevels();
|
Hyprland.refreshToplevels();
|
||||||
// Workspace and window updates are deferred via timers to avoid
|
// Workspace and window updates are deferred — refreshWorkspaces()/
|
||||||
// re-entrant incubation — refreshWorkspaces()/refreshToplevels()
|
// refreshToplevels() trigger onValuesChanged which also calls
|
||||||
// trigger onValuesChanged which restarts the respective timers.
|
// Qt.callLater, so the deduplication coalesces into one update.
|
||||||
workspaceUpdateTimer.restart();
|
Qt.callLater(_deferredWorkspaceUpdate);
|
||||||
updateTimer.restart();
|
updateTimer.restart();
|
||||||
|
|
||||||
const monitorsEvents = ["configreloaded", "monitoradded", "monitorremoved", "monitoraddedv2", "monitorremovedv2"];
|
const monitorsEvents = ["configreloaded", "monitoradded", "monitorremoved", "monitoraddedv2", "monitorremovedv2"];
|
||||||
|
|||||||
Reference in New Issue
Block a user