Project

General

Profile

Actions

Bug #2499

open

gtk4: Detached tab is never freed

Added by Sweet Tea Dorminy 11 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
gtk4-client
Target version:
-
Start date:
11/22/2026
Due date:
% Done:

0%

Estimated time:

Description

Double-click the "Diplomacy [1]" tab label to detach it into a window, then close the window with its close button. When the server's cancel comes back:

GLib-GObject: invalid unclassed pointer in cast to 'GtkWindow'
Gtk: gtk_window_destroy: assertion 'GTK_IS_WINDOW (window)' failed

and later, on disconnect, gui_dialog_destroy_all() writes into the already freed dipl_main (heap-use-after-free under ASan).

gui_dialog_detach() takes a reference on dlg->grid so gtk_notebook_remove_page() won't destroy it, and never drops it. When the window is destroyed the grid survives, so gui_dialog_destroy_handler() never runs: the gui_dialog and the whole tab content leak, the dialog stays in dialog_list, and its v.window and source point at things that are gone. This happens to any detached tab, not only diplomacy.

Attached patch drops the reference once the window holds the grid.

Depends on #2498 ; without it, closing the window would then free the dialog behind diplomacy's back.


Files


Related issues 1 (1 open — 0 closed)

Blocked by Bug #2498: gtk4: crash after closing diplomacy windowIn ReviewMarko Lindqvist11/22/2026

Actions
Actions

Also available in: Atom PDF