From 4a4775b79c8beb328757867a3702a977bf9354e1 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 5 Sep 2024 12:21:45 -0500 Subject: [PATCH] Editor: Fix bug when calling update_edit_menu at startup --- spyder/plugins/editor/widgets/main_widget.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/editor/widgets/main_widget.py b/spyder/plugins/editor/widgets/main_widget.py index faa231594bd..8a3424373c1 100644 --- a/spyder/plugins/editor/widgets/main_widget.py +++ b/spyder/plugins/editor/widgets/main_widget.py @@ -1250,7 +1250,11 @@ def update_edit_menu(self): editor = self.get_current_editor() readwrite_editor = possible_text_widget == editor - if readwrite_editor and not editor.isReadOnly(): + # We need the first validation to avoid a bug at startup. That probably + # happens when the menu is tried to be rendered automatically in some + # Linux distros. + # Fixes spyder-ide/spyder#22432 + if editor is not None and readwrite_editor and not editor.isReadOnly(): # Case where the current editor has the focus if not self.is_file_opened(): return