GNOME Bugzilla – Bug 733689
Editing a GtkEntry with completion, causes CRITICAL glib error
Last modified: 2014-07-29 10:24:58 UTC
Similar to the problem solved with commit 1f8d021d3023830e3701c304859f789dd30bd0d9 in GtkTreeView, editing in GtkEntry with a EntryCompletion attached, causes the known error about removing a source that doesn't exist. 1) Enter 'a' in the entry, 2) Backspace (deleting the 'a') 3) Enter 'a' again This is sufficient to cause the problem. This is with gtk-2.24.24, and glib 2.40.0
doesn't happen here, in quick testing with gtk-demo. Could you provide a patch ?
I still don't understand what is going wrong, but I've been able to get nearer to the problem, I think. Previously, I was not able to debug, because the popdown list blocked the entire GUI. I've now found that the same error appears when typing a key which is not in the dropdown, and as such got a little further. The problem seems to be in gtk_entry_completion changed, in the g_source_free call: static void gtk_entry_completion_changed (GtkWidget *entry, gpointer user_data) { GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (user_data); /* (re)install completion timeout */ if (completion->priv->completion_timeout) g_source_remove (completion->priv->completion_timeout); if (!gtk_entry_get_text (GTK_ENTRY (entry))) return; /* no need to normalize for this test */ if (completion->priv->minimum_key_length > 0 && This is the backtrace:
+ Trace 233890
Thread 1 (Thread 0x7ffff7f99900 (LWP 15484))
Ok, pure guesswork, but I suspect that code (around line 9610 in gtkentry.c, has to be: /* (re)install completion timeout */ if (completion->priv->completion_timeout) { g_source_remove (completion->priv->completion_timeout); completion->priv->completion_timeout = 0; } Else, a repeated call to that function can cause a duplicate g_source_remove(). I recompiled and tested, and behold, the error is gone.
Created attachment 281904 [details] [review] Avoid duplicate g_source_remove
Uploaded a patch... First time ever, hope it's correct.