Gdk.Event based structs are not usable after signal callbacks are finished
Submitted by Simon Feltman
This is related to bug 736175 and bug 722899 with added complication that various signals like 'button-press-event' pass a bare Gdk.EventButton struct, not a boxed Gdk.Event. This leads to a marshaling path where we don't do any memory management and simply wrap the raw pointer in a PyGIStruct.
This can be seen by attempting to store the event struct outside of the callback:
events =  def on_button_press(widget, event): events.append(events)
events # this will point to already free'd memory
I think ultimately the fix here might be to change GTK+ to use Gdk.Event as the signal annotation instead of Gdk.EventButton  The add better union discrimination to pygi, and eventually add introspection support for union discrimination (see bug 681409).