[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Problems with GtkButton & GtkText



I'm using Gtk 1.2 and I have some questions.

1.
I want to disable a GtkButton when it is pressed. I have tested to do it 
like this in the buttons signal handler for "pressed":

void buttonPressed(GtkButton *button, gpointer data)
{
	//do stuff

	gtk_widget_set_sensitive(GTK_WIDGET(button), false);
}

With this code the program will crash (the GUI is frozen) after the button 
is pressed. Is this a bug or is it a rule that a signal handler must leave 
the state of the object it is called on? Is there an easy way around this?


2.
My program is multi-threaded and I want to have a number of separate windows 
with scrollable GtkText widgets. It is only one thread that writes to the 
text widgets. I have followed the answer in the faq for making the program 
thread-safe, i.e, I start the program with g_thread_init(NULL) and wrap all 
gtk calls inside gdk_threads_enter() & gdk_threads_leave(). Everything works 
fine at first but after a while the program crashes and writes some strange 
error messages that may be different from time to time. It can, for example, 
look like this:

Gdk-ERROR **: BadIDChoice (invalid resource ID chosen for this connection)
  serial 30610 error_code 14 request_code 1 minor_code 0
Gdk-ERROR **: BadIDChoice (invalid resource ID chosen for this connection)
  serial 30611 error_code 14 request_code 1 minor_code 0

or like this:

Gdk-ERROR **: BadLength (poly request too large or internal Xlib length erro
  serial 30211 error_code 16 request_code 6 minor_code 0

The crash happens when something is written to the text widget, but only 
sometimes. Does anyone has a clue why this happens?


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]