Corrupt GDK_DESTROY event
- From: Matthew Allen <memecode gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Corrupt GDK_DESTROY event
- Date: Sat, 16 Jan 2016 12:36:13 +1100
I'm developing applications based on a widget library called LGI:
https://github.com/memecode/Lgi
The Linux back end uses GTK2 and I'm having trouble with the GDK_DESTROY
event being corrupt by the time it reaches my application.
In GWindow::Attach I setup a the signal handler:
GView *i = this;
g_signal_connect( G_OBJECT(Wnd),
"destroy",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"delete_event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"configure-event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"button-press-event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"focus-in-event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"focus-out-event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"client-event",
G_CALLBACK(GtkViewCallback),
i);
g_signal_connect( G_OBJECT(Wnd),
"window-state-event",
G_CALLBACK(GtkViewCallback),
i);
GtkViewCallback gets a normal GDK_DELETE, but instead of a GDK_DESTROY
following that the GdkEvent is full of garbage memory. I know it's supposed
to be a GDK_DESTROY, because if I change the GtkViewCallback to a specific
callback for just the destroy signal, that new "destroy" callback is called
(instead of GtkViewCallback) with a corrupt event pointer. GtkViewCallback
is just a simple glue like:
gboolean GtkViewCallback(GtkWidget *widget, GdkEvent *event, GView *This)
{
if (event->type < 0 || event->type > 1000)
{
printf("%s:%i - CORRUPT EVENT %i\n", __FILE__, __LINE__,
event->type);
return false;
}
return This->OnGtkEvent(widget, event);
}
GWindow::OnGtkEvent switchs on the event and does different things. Some of
which follows:
switch (event->type)
{
case GDK_DELETE:
{
bool Close = OnRequestClose(false);
if (Close)
OnGtkDelete();
return !Close;
}
case GDK_DESTROY: // not called because the event is corrupt...
{
delete this;
return true;
}
....
The OnGtkDelete just clears all the widget pointers in my view hierarchy so
I don't use them after the delete event. It's recursive...
Before I tear the app down to a minimal example and comment most of it out
to try and isolate the cause of the corruption I thought maybe someone on
this list could shed some light on my issue. Or maybe just give me a
direction to head in terms of where I should be looking?
I have the GTK symbols installed on Linux but not a debug build. I'm using
Ubuntu 14. A full debug build would be nice so I can step through the GTK
code easily. Is there an easy way to set that up?
Regards
Matt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]