Re: Problems with GtkButton & GtkText



As for the button thing... did you try running it through gdb?  The only
time my GUI freezes without producing any warnings is when the UI
reaches an infinite loop.  GDB may help you pin-point the problem.
Also, try putting a print statement after you set the widget
sensitivity, and see if it ever reaches that point at all.  

        --mattgerg

On 23 Jul 2001 15:39:37 +0000, Henrik Grimm wrote:
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


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







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