gtk_timeout_remove causes seg fault
- From: Marco Slaviero <slaviero ibi co za>
- To: gtk-app-devel-list gnome org
- Subject: gtk_timeout_remove causes seg fault
- Date: Tue, 17 Jul 2001 20:30:44 +0200 (SAST)
Hello All
I am starting out with C and GTK+, and have come across a stumbling point.
Basically, I add a timeout which calls a network function, to refresh data
every so often. When the program is disconnected from the network,
obviously I don't want the program to carry on refreshing.
I have tried two strategies:
1) Call gtk_timeout_remove in the disconnect function.
This seg faults when calling gtk_timeout_remove.
2) Return FALSE if the network is disconnected.
This too causes a seg fault in gtk_timeout_remove.
A bt in gdb for 2 looks like this.
#0 0x4041d0e4 in chunk_free (ar_ptr=0x404b1d60, p=0x80a8030) at
malloc.c:3100
#1 0x4041cfba in __libc_free (mem=0x80a8038) at malloc.c:3023
#2 0x403ac36d in g_free ()
#3 0x403aaae0 in g_source_destroy_func ()
#4 0x403a87b3 in g_hook_free ()
#5 0x403a8aa8 in g_hook_unref ()
#6 0x403ab20e in g_main_dispatch ()
#7 0x403ab751 in g_main_iterate ()
#8 0x403ab8f1 in g_main_run ()
#9 0x401c67b9 in gtk_main ()
A bt for 1 is longer, but ends up like this too.
The odd thing is that when I connect and disconnect before the timeout has
occured, there is no seg fault. In other words:
-Connect to network, add timeout
-Disconnect
-Timeout is triggered, but is disconnected so exits with FALSE.
-No seg fault
I doubt there is a problem with gtk_timeout_remove, as I have not been
able to find anything in the archives. Are there any obvious problems?
That last bit seems to indicate a problem with the code in function that
is called on the timeout.
I realise it is difficult to diagnose remotely, but any feedback is
appreciated.
--
Regards
Marco Slaviero
"Ruthless logic is the sign of a limited mind" -- Doc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]