From 4a8776a42ddf17944ab69288117f2bceeede576d Mon Sep 17 00:00:00 2001 From: Pavel Baksy Date: Tue, 10 Feb 2026 23:34:39 +0100 Subject: [PATCH] Fix export button crash for saved requests by using async callback --- src/window.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/window.py b/src/window.py index 4272990..c1e86dd 100644 --- a/src/window.py +++ b/src/window.py @@ -1183,9 +1183,8 @@ class RosterWindow(Adw.ApplicationWindow): return # Apply variable substitution if environment is selected - substituted_request = request - if widget.selected_environment_id: - env = widget.get_selected_environment() + def show_export(env): + substituted_request = request if env: from .variable_substitution import VariableSubstitution substituted_request, undefined = VariableSubstitution.substitute_request(request, env) @@ -1196,10 +1195,15 @@ class RosterWindow(Adw.ApplicationWindow): # Show warning toast but continue with export self._show_toast(f"Warning: {len(undefined)} undefined variable(s)") - # Show export dialog with substituted request - from .export_dialog import ExportDialog - dialog = ExportDialog(substituted_request) - dialog.present(self) + # Show export dialog with substituted request + from .export_dialog import ExportDialog + dialog = ExportDialog(substituted_request) + dialog.present(self) + + if widget.selected_environment_id: + widget.get_selected_environment(show_export) + else: + show_export(None) def _mark_tab_as_saved(self, saved_request_id, name, request, scripts=None): """Mark the current tab as saved (clear modified flag)."""