After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324638 - changed signal emitted too many times after call to set_text
changed signal emitted too many times after call to set_text
Status: RESOLVED DUPLICATE of bug 64998
Product: gtk+
Classification: Platform
Component: .General
2.6.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-12-20 20:37 UTC by jamesp
Modified: 2005-12-21 06:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jamesp 2005-12-20 20:37:18 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:
Comment 1 Matthias Clasen 2005-12-21 06:51:38 UTC
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 ***