Dont know if this is a bug or if I’m doing something that is not allowed without knowing it.
I have a GtkBox and inside it I’ve got 5 GtkBox, each of them contains a GtkEditableLabel and a GtkButton.
The GtkButton clicked signal is connected to a function to delete its parent from the main GtkBox.
(When I wrote it I felt that this designing was problematic, but as it was just for fun I kept it that way).
The problem is:
I can delete all boxes except the first one apparently fine, if I delete all 5 children boxes then the application is terminated, no error message on terminal, just “application terminated”. If I begin to delete it from the first box then it’ll crash without me being able to delete all 5 of them, if I start by the last one it’ll only crash when I delete the first.
More info:
If I have only one box inside the main box then I can delete it fine.
If I have one GtkLabel instead of GtkEditableLabel I can delete all boxes just fine.
If instead of a Box I have a GtkListBox with 5 children boxes then it doesn’t happen either.
If instead of connecting the clicked signal to the button inside the box I connect to an external button then it doesn’t happen either.
I’ve also tried deleting it with g_iddle_add to see if I would get any result but nope, same thing happen.
When running on debug the last calls were:
0: gtk_event_controller_get_widget
1: stop_editing_soon
2: g_timeout_dispatch
3: g_main_context_dispatch
For context:
I intend to write a kanban application and i’d like to keep the GtkEditableLabel so the title of the cards is editable and the delete button so I can discard it when its necessary. At first I thought about using a GtkListBox or a GtkListView but then went with a GtkBox.
I decided to post this here because even though it works fine with a GtkListBox maybe the design is not right and I’m being lucky with the listbox.
Edited with version:
gtk 4.6.6
popOs 22.04