RE: Problems with GtkButton & GtkText



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.
  Try to write the simple test program: window with the big button in it and
  button's click should disable button (add no other stuff). If it works
  fine then your bug (GUI frozzing) is not here (where button is).

Is this a bug or
is it a rule that a signal handler must leave the state of
the object it is called on?
  No, imho. Signal handler may change the states of the object (imho).

Is there an easy way around this?
  Well, _imho_ `gtk_widget_set_sensetive` is emmiting signal then called
  (something like "state_changed"). But there _may_ be (and may be not)
  some bugs when emmiting one signal during other signal's handler
  work.

---
 Dmitry Ponomaryov





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