Drag & Drop causes spurious ref count imbalance on placeholders
@tvb
Submitted by Tristan Van Berkom Link to original bug (#739764)
Description
This problem was discovered while reviewing & testing the headerbar branch (bug 700914) and is the cause of the orphaned project widget described in the following comment:
https://bugzilla.gnome.org/show_bug.cgi?id=700914#c39
It only occurs when the button is added by dragging it from the palette and dropping it into the headerbar placeholder.
Hints for investigation:
o This is certainly not specific to headerbar
o To reproduce:
try adding a (gdb) breakpoint where the headerbar (or GtkBox)
size property changes and a new placeholder is added.
Save the address of the newly created placeholder
Break in the container adaptor's ->replace_child() function
Drag & Drop a widget to the newly added placeholder
This will cause the ->replace_child() to be called, replacing the
placeholder with the new project widget
Now inspect the reference count of the placeholder
The placeholder is normally expected to have a reference count of 1 (asides from the references that event handling signals have on the placeholder) and to automatically destroy itself after having been removed from the container and the event handling completed.
This is the sequence that normally occurs if drag and drop is not used to add a widget to the new placeholder.
However, with drag and drop, a seemingly random number of extra references are added (I've seen the placeholder have reference counts of 5, and reference counts of 11, after performing the same sequence).