Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
e2706c6b by cal0pteryx at 2026-03-21T13:32:29+01:00
fix: Workspaces: Check if workspace exists before saving

Workspaces may be deleted while WorkspaceDialog is open,
which creates an error when trying to save settings.

Fixes #12673

- - - - -


2 changed files:

- gajim/common/settings.py
- gajim/gtk/workspace_dialog.py


Changes:

=====================================
gajim/common/settings.py
=====================================
@@ -1205,6 +1205,9 @@ def sort_workspaces(workspace_id: str) -> int:
         workspaces.sort(key=sort_workspaces)
         return workspaces
 
+    def workspace_exists(self, workspace_id: str) -> bool:
+        return workspace_id in app.settings.get_workspaces()
+
     def add_workspace(self, name: str) -> str:
         id_ = str(uuid.uuid4())
         self._settings['workspaces'][id_] = {


=====================================
gajim/gtk/workspace_dialog.py
=====================================
@@ -104,7 +104,9 @@ def _on_image_switch_toggled(self, switch: Gtk.Switch, 
*args: Any) -> None:
         self._avatar_selector.reset()
         if switch.get_active():
             self._ui.style_stack.set_visible_child_name("image")
-            if self._workspace_id is not None:
+            if self._workspace_id is not None and 
app.settings.workspace_exists(
+                self._workspace_id
+            ):
                 self._avatar_sha = app.settings.get_workspace_setting(
                     self._workspace_id, "avatar_sha"
                 )
@@ -152,7 +154,9 @@ def _on_save(self, _button: Gtk.Button) -> None:
             if data is not None:
                 self._avatar_sha = app.app.avatar_storage.save_avatar(data)
 
-        if self._workspace_id is not None:
+        if self._workspace_id is not None and app.settings.workspace_exists(
+            self._workspace_id
+        ):
             app.settings.set_workspace_setting(self._workspace_id, "name", 
name)
             app.settings.set_workspace_setting(
                 self._workspace_id, "color", rgba.to_string()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/e2706c6b5a29446b1ca52bb274c554c4812baeb6

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/e2706c6b5a29446b1ca52bb274c554c4812baeb6
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to