GNOME Bugzilla – Bug 324638
changed signal emitted too many times after call to set_text
Last modified: 2005-12-21 06:51:38 UTC
Please describe the problem: It seems that the "changed" signal is being emitted twice when there is text in the entry and then the text is changed via gtk_entry_set_text. Here's a small snip-it: #include <gtk/gtk.h> static changed( GtkEditable *editable, gpointer data ) { printf( "changed to text '%s'\n", gtk_entry_get_text(GTK_ENTRY(editable)) ); } int main( int argc, char **argv ) { GtkWidget *entry; gtk_init( &argc, &argv ); entry = gtk_entry_new(); g_signal_connect( G_OBJECT(entry), "changed", G_CALLBACK(changed), NULL ); gtk_entry_set_text( GTK_ENTRY(entry), "hello" ); gtk_entry_set_text( GTK_ENTRY(entry), "world" ); return 0; } This code produces the following output: changed to text 'hello' changed to text '' changed to text 'world' The text has only acutally changed twice, not three times. This seems to me to be an undesirable side-effect of the implementation of set_text(). Steps to reproduce: run the supplied program Actual results: Three lines of output Expected results: Two lines of output: changed to text 'hello' changed to text 'world' Does this happen every time? yes Other information:
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 64998 ***