From d759d9b5d5d51dc397551b717ba3e7f1af2d7b1e Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 29 Sep 2026 21:14:53 +0300
Subject: [PATCH 36/36] gtk4: Fix diplodlg double destruction

See RM #2306

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-gtk-4.0/diplodlg.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c
index bb2f6c2238..bbe2b0dea1 100644
--- a/client/gui-gtk-4.0/diplodlg.c
+++ b/client/gui-gtk-4.0/diplodlg.c
@@ -690,16 +690,14 @@ static void diplomacy_main_response(struct gui_dialog *dlg, int response,
 }
 
 /************************************************************************//**
-  Destroy diplomacy dialog
+  Remove diplomacy dialog from use.
 ****************************************************************************/
-static void diplomacy_destroy(struct Diplomacy_dialog *pdialog)
+static void diplomacy_remove(struct Diplomacy_dialog *pdialog)
 {
-  if (NULL != pdialog->dialog) {
-    /* pdialog->dialog may be NULL if the tab has been destroyed
-     * by an other way. */
-    gui_dialog_destroy(pdialog->dialog);
-    pdialog->dialog = NULL;
-  }
+  /* Dialog destroy callbacks will take care of freeing everything
+   * related to the pdialog->dialog.
+   * Here we just take the dialog out of use. */
+
   dialog_list_remove(dialog_list, pdialog);
 
   if (dialog_list) {
@@ -1279,7 +1277,7 @@ static void diplomacy_dialog_shared_tiles_callback(GSimpleAction *action,
 ****************************************************************************/
 void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog)
 {
-  diplomacy_destroy(pdialog);
+  diplomacy_remove(pdialog);
 }
 
 /************************************************************************//**
-- 
2.53.0

