From 79666c1b2af19ee785cc4b79e6b8e1ec776daa05 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 5 Oct 2023 22:58:55 +0300 Subject: [PATCH 32/32] gtk: Avoid double diplodlg free Reported by mortmann See osdn #48807 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/diplodlg.c | 3 ++- client/gui-gtk-3.22/diplodlg.c | 3 ++- client/gui-gtk-4.0/diplodlg.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/gui-gtk-3.0/diplodlg.c b/client/gui-gtk-3.0/diplodlg.c index e1027a957d..30acd09215 100644 --- a/client/gui-gtk-3.0/diplodlg.c +++ b/client/gui-gtk-3.0/diplodlg.c @@ -605,9 +605,10 @@ static void diplomacy_main_response(struct gui_dialog *dlg, int response, static void diplomacy_destroy(struct Diplomacy_dialog* pdialog) { if (NULL != pdialog->dialog) { - /* pdialog->dialog may be NULL if the tab have been destroyed + /* pdialog->dialog may be NULL if the tab has been destroyed * by an other way. */ gui_dialog_destroy(pdialog->dialog); + pdialog->dialog = NULL; } dialog_list_remove(dialog_list, pdialog); free(pdialog); diff --git a/client/gui-gtk-3.22/diplodlg.c b/client/gui-gtk-3.22/diplodlg.c index 9df2ae4323..63c05dab4c 100644 --- a/client/gui-gtk-3.22/diplodlg.c +++ b/client/gui-gtk-3.22/diplodlg.c @@ -603,9 +603,10 @@ static void diplomacy_main_response(struct gui_dialog *dlg, int response, static void diplomacy_destroy(struct Diplomacy_dialog* pdialog) { if (NULL != pdialog->dialog) { - /* pdialog->dialog may be NULL if the tab have been destroyed + /* pdialog->dialog may be NULL if the tab has been destroyed * by an other way. */ gui_dialog_destroy(pdialog->dialog); + pdialog->dialog = NULL; } dialog_list_remove(dialog_list, pdialog); free(pdialog); diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c index 317ad530c2..9163c1aa80 100644 --- a/client/gui-gtk-4.0/diplodlg.c +++ b/client/gui-gtk-4.0/diplodlg.c @@ -665,12 +665,13 @@ static void diplomacy_main_response(struct gui_dialog *dlg, int response, /************************************************************************//** Destroy diplomacy dialog ****************************************************************************/ -static void diplomacy_destroy(struct Diplomacy_dialog* pdialog) +static void diplomacy_destroy(struct Diplomacy_dialog *pdialog) { if (NULL != pdialog->dialog) { - /* pdialog->dialog may be NULL if the tab have been destroyed + /* pdialog->dialog may be NULL if the tab has been destroyed * by an other way. */ gui_dialog_destroy(pdialog->dialog); + pdialog->dialog = NULL; } dialog_list_remove(dialog_list, pdialog); free(pdialog); -- 2.40.1