Project

General

Profile

Actions

Bug #2498

open

gtk4: crash after closing diplomacy window

Added by Sweet Tea Dorminy 11 days ago. Updated 4 days ago.

Status:
In Review
Priority:
Low
Category:
gtk4-client
Target version:
Start date:
11/22/2026
Due date:
% Done:

0%

Estimated time:

Description

With "Enable status report tabs" off, a diplomacy meeting opens as a window. Close it with the window's close button, and when the server's cancel comes back the client uses freed memory. Under ASan:

heap-use-after-free READ in gui_dialog_destroy gui_stuff.c
<- diplomacy_destroy diplodlg.c <- gui_recv_cancel_meeting <- handle_diplomacy_cancel_meeting
freed by gui_dialog_destroy_handler, called by gtk from the window close

gui_dialog_delete_handler() emits the delete response and returns FALSE, so gtk destroys the window. The diplomacy response only asks the server to cancel, so pdialog->dialog (and all its widgets) is gone while the meeting is still on, and since #2371 nothing clears pdialog->dialog except gui_dialog_destroy(). The main Diplomacy window does the same with dipl_main->dialog.

Attached patch returns TRUE, so a window behaves like a tab (its close button and Escape already only emit the response): the response callback decides, and the dialog is destroyed only through gui_dialog_destroy(). All other gui_dialog owners already destroy the dialog in their delete response, so only diplomacy changes: its window now closes when the server's cancel arrives, as the tab does.

Blocked by: #2397


Files


Related issues 1 (1 open — 0 closed)

Blocks Bug #2499: gtk4: Detached tab is never freedNew11/22/2026

Actions
Actions #1

Updated by Marko Lindqvist 4 days ago

  • Blocks Bug #2499: gtk4: Detached tab is never freed added
Actions #2

Updated by Marko Lindqvist 4 days ago

Outside the scope of this ticket of course, but we should also look at how diplomacy dialog destruction works in case of unexpectedly lost server connection. (to a degree, that can be simulated on a single computer by intentionally crashing the server)

Actions #3

Updated by Marko Lindqvist 4 days ago

  • Status changed from New to In Review
  • Assignee set to Marko Lindqvist
  • Target version set to 3.2.8
Actions

Also available in: Atom PDF