small GTK test program crashes after 3 days
- From: "Brian Ford" <bford rossvideo com>
- To: <gtk-app-devel-list gnome org>
- Subject: small GTK test program crashes after 3 days
- Date: Fri, 11 Jul 2008 14:04:37 -0400
I am having a problem with my gtk program doing a seg fault after
running for a long period of time. My application redraws the screen
with quite a high frequency. I decided to to creating a tiny test
program that simply sets icons on a toolbar over and over to see if I
could replicate the problem my application is having. After almost 3
days my test gtk program segfault'ed in the same manner. It does not
seem to be a memory leak as the memory usage of the program did not grow
over time.
I am using Fedora Core 6 and all the standard GTK, Glib libraries that
it contained, i.e. GTK 2.10.8
When I tried this on a PC running Fedora8 and a new gtk library I did
not see the issue but perhaps it just takes longer before it would
crash.
Here is the backtrace:
Core was generated by `./gtktest'.
Program terminated with signal 11, Segmentation fault.
#0 0xb79d864e in gdk_region_destroy () from
/usr/lib/libgdk-x11-2.0.so.0
(gdb) bt
#0 0xb79d864e in gdk_region_destroy () from
/usr/lib/libgdk-x11-2.0.so.0
#1 0xb79f3890 in gdk_x11_gc_get_xdisplay () from
/usr/lib/libgdk-x11-2.0.so.0
#2 0xb79f3baf in gdk_x11_gc_get_xdisplay () from
/usr/lib/libgdk-x11-2.0.so.0
#3 0xb79f3c65 in gdk_x11_gc_get_xdisplay () from
/usr/lib/libgdk-x11-2.0.so.0
#4 0xb79db53f in gdk_window_is_viewable () from
/usr/lib/libgdk-x11-2.0.so.0
#5 0xb79db877 in gdk_window_process_all_updates ()
from /usr/lib/libgdk-x11-2.0.so.0
#6 0xb7c0d712 in gtk_container_check_resize ()
from /usr/lib/libgtk-x11-2.0.so.0
#7 0xb780d6e1 in g_source_is_destroyed () from /lib/libglib-2.0.so.0
#8 0xb780f442 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#9 0xb781241f in g_main_context_check () from /lib/libglib-2.0.so.0
#10 0xb7812985 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#11 0xb7c9e2b3 in gtk_main_iteration_do () from
/usr/lib/libgtk-x11-2.0.so.0
#12 0x08048ce9 in main ()
Here is the code for my test program.. I used glade to create the
window and a toolbar with three buttons on it. I can provide the glade
file if anyone wants it.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
extern GtkWidget *tool_button[3];
static int x = 0;
GtkWidget *MainWindow;
GtkWidget *tool_button[3];
gboolean UpdateToolbar(gpointer data)
{
if(++x > 3)
x = 0;
switch(x)
{
default:
case 0:
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[0]),
GTK_STOCK_MEDIA_STOP);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[1]),
GTK_STOCK_NETWORK);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[2]),
GTK_STOCK_JUSTIFY_RIGHT);
break;
case 1:
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[0]),
GTK_STOCK_SAVE);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[1]),
GTK_STOCK_UNDO);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[2]),
GTK_STOCK_ZOOM_IN);
break;
case 2:
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[0]),
GTK_STOCK_ZOOM_OUT);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[1]),
GTK_STOCK_YES);
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON(tool_button[2]),
GTK_STOCK_OPEN);
break;
}
}
int main(int argc, char*argv[])
{
int i;
GladeXML *xml;
gtk_init(&argc, &argv);
glade_init();
xml = glade_xml_new("gtktest.glade", "MainWindow", NULL);
glade_xml_signal_autoconnect(xml);
MainWindow = glade_xml_get_widget(xml, "MainWindow");
tool_button[0] = glade_xml_get_widget(xml, "toolbutton1");
tool_button[1] = glade_xml_get_widget(xml, "toolbutton2");
tool_button[2] = glade_xml_get_widget(xml, "toolbutton3");
g_object_unref( G_OBJECT(xml) );
while(1)
{
UpdateToolbar(NULL);
gtk_main_iteration_do(0);
}
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]