launcher: attempt at fixing potential crash when launching app

This commit is contained in:
Lemmy
2026-02-10 19:44:59 -05:00
parent 43079fe801
commit b13e1936dc
3 changed files with 8 additions and 8 deletions
+3 -1
View File
@@ -160,7 +160,9 @@ SmartPanel {
screen: root.screen
isOpen: root.isPanelOpen
onRequestClose: root.close()
onRequestCloseImmediately: root.closeImmediately()
// Defer so the signal emission completes before SmartPanel
// sets isPanelOpen=false and the contentLoader destroys us.
onRequestCloseImmediately: Qt.callLater(root.closeImmediately)
}
}
+1 -5
View File
@@ -23,11 +23,7 @@ Rectangle {
signal requestCloseImmediately
function closeImmediately() {
// Must be deferred — SmartPanel.closeImmediately() sets isPanelOpen=false
// which deactivates the contentLoader and destroys us mid-signal-chain.
Qt.callLater(function () {
requestCloseImmediately();
});
requestCloseImmediately();
}
// Expose for preview panel positioning
@@ -547,9 +547,11 @@ Item {
"_score": (score !== undefined ? score : 0),
"provider": root,
"onActivate": function () {
// Record usage before closing (provider may be destroyed after close)
// Defer usage recording — must run before closeImmediately's deferred
// handler destroys us, but outside the delegate click call stack to
// avoid property-change cascades mid-handler.
if (Settings.data.appLauncher.sortByMostUsed) {
root.recordUsage(app);
Qt.callLater(() => root.recordUsage(app));
}
// Close the launcher/SmartPanel immediately without any animations.