Skip to content

Commit f231987

Browse files
authored
Merge pull request #1617 from byquanton/fix/view-stack-crash
2 parents 26e2484 + 17b8bc6 commit f231987

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/MainWindow.vala

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,19 @@ public class MainWindow : Adw.ApplicationWindow {
453453
if (project_view != null) {
454454
if (views_stack.visible_child == project_view) {
455455
go_homepage ();
456+
// Use a timeout to ensure the view transition is complete before cleanup
457+
GLib.Timeout.add (views_stack.transition_duration, () => {
458+
project_view.clean_up ();
459+
project_view.destroy ();
460+
views_stack.remove (project_view);
461+
return GLib.Source.REMOVE;
462+
});
463+
} else {
464+
// If not visible, we can clean up immediately
465+
project_view.clean_up ();
466+
project_view.destroy ();
467+
views_stack.remove (project_view);
456468
}
457-
458-
project_view.clean_up ();
459-
project_view.destroy ();
460-
461-
views_stack.remove (project_view);
462469
}
463470
}
464471

0 commit comments

Comments
 (0)