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 733689 - Editing a GtkEntry with completion, causes CRITICAL glib error
Editing a GtkEntry with completion, causes CRITICAL glib error
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkEntry
2.24.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-07-24 17:24 UTC by John
Modified: 2014-07-29 10:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoid duplicate g_source_remove (510 bytes, patch)
2014-07-29 05:39 UTC, John
committed Details | Review

Description John 2014-07-24 17:24:10 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
Comment 1 Matthias Clasen 2014-07-25 02:18:33 UTC
doesn't happen here, in quick testing with gtk-demo. Could you provide a patch ?
Comment 2 John 2014-07-29 04:35:31 UTC
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:

Thread 1 (Thread 0x7ffff7f99900 (LWP 15484))

  • #0 g_logv
    at gmessages.c line 1038
  • #1 g_log
    at gmessages.c line 1071
  • #2 g_source_remove
    at gmain.c line 2194
  • #3 gtk_entry_completion_changed
    at gtkentry.c line 9610
  • #4 g_closure_invoke
    at gclosure.c line 768
  • #5 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #6 g_signal_emit_valist
    at gsignal.c line 3307
  • #7 g_signal_emit_by_name
    at gsignal.c line 3403
  • #8 emit_changed
    at gtkentry.c line 2414
  • #9 buffer_notify_text
    at gtkentry.c line 4653
  • #10 g_closure_invoke
    at gclosure.c line 768
  • #11 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #12 g_signal_emit_valist
    at gsignal.c line 3307
  • #13 g_signal_emit
    at gsignal.c line 3363
  • #14 g_object_dispatch_properties_changed
    at gobject.c line 1053
  • #15 g_object_notify_by_spec_internal
    at gobject.c line 1147
  • #16 g_object_notify
    at gobject.c line 1194
  • #17 gtk_entry_buffer_real_inserted_text
    at gtkentrybuffer.c line 229
  • #18 g_closure_invoke
    at gclosure.c line 768
  • #19 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #20 g_signal_emit_valist
    at gsignal.c line 3307
  • #21 g_signal_emit
    at gsignal.c line 3363
  • #22 IA__gtk_entry_buffer_emit_inserted_text
    at gtkentrybuffer.c line 731
  • #23 gtk_entry_buffer_normal_insert_text
    at gtkentrybuffer.c line 180
  • #24 gtk_entry_real_insert_text
    at gtkentry.c line 4540
  • #25 g_closure_invoke
    at gclosure.c line 768
  • #26 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #27 g_signal_emit_valist
    at gsignal.c line 3307
  • #28 g_signal_emit_by_name
    at gsignal.c line 3403
  • #29 gtk_entry_insert_text
    at gtkentry.c line 4277
  • #30 gtk_entry_enter_text
    at gtkentry.c line 5220
  • #31 g_cclosure_marshal_VOID__STRINGv
    at gmarshal.c line 1004
  • #32 _g_closure_invoke_va
    at gclosure.c line 831
  • #33 g_signal_emit_valist
    at gsignal.c line 3215
  • #34 g_signal_emit_by_name
    at gsignal.c line 3403
  • #35 g_cclosure_marshal_VOID__STRINGv
    at gmarshal.c line 1004
  • #36 _g_closure_invoke_va
    at gclosure.c line 831
  • #37 g_signal_emit_valist
    at gsignal.c line 3215
  • #38 g_signal_emit_by_name
    at gsignal.c line 3403
  • #39 gtk_im_context_simple_commit_char
    at gtkimcontextsimple.c line 168
  • #40 no_sequence_matches
    at gtkimcontextsimple.c line 787
  • #41 gtk_im_context_simple_filter_keypress
    at gtkimcontextsimple.c line 1101
  • #42 gtk_im_multicontext_filter_keypress
    at gtkimmulticontext.c line 333
  • #43 gtk_entry_key_press
    at gtkentry.c line 4067
  • #44 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 86
  • #45 g_closure_invoke
    at gclosure.c line 768
  • #46 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #47 g_signal_emit_valist
    at gsignal.c line 3317
  • #48 g_signal_emit
    at gsignal.c line 3363
  • #49 gtk_widget_event_internal
    at gtkwidget.c line 5010
  • #50 IA__gtk_widget_event
    at gtkwidget.c line 4807
  • #51 IA__gtk_window_propagate_key_event
    at gtkwindow.c line 5199
  • #52 gtk_window_key_press_event
    at gtkwindow.c line 5229
  • #53 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 86
  • #54 g_closure_invoke
    at gclosure.c line 768
  • #55 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #56 g_signal_emit_valist
    at gsignal.c line 3317
  • #57 g_signal_emit
    at gsignal.c line 3363
  • #58 gtk_widget_event_internal
    at gtkwidget.c line 5010
  • #59 IA__gtk_widget_event
    at gtkwidget.c line 4807
  • #60 IA__gtk_propagate_event
    at gtkmain.c line 2464
  • #61 IA__gtk_main_do_event
    at gtkmain.c line 1685
  • #62 gdk_event_dispatch
    at gdkevents-x11.c line 2403
  • #63 g_main_dispatch
    at gmain.c line 3064
  • #64 g_main_context_dispatch
    at gmain.c line 3663
  • #65 g_main_context_iterate
    at gmain.c line 3734
  • #66 g_main_loop_run
    at gmain.c line 3928
  • #67 IA__gtk_main
    at gtkmain.c line 1257
  • #68 main
    at main.c line 329

Comment 3 John 2014-07-29 05:24:58 UTC
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.
Comment 4 John 2014-07-29 05:39:42 UTC
Created attachment 281904 [details] [review]
Avoid duplicate g_source_remove
Comment 5 John 2014-07-29 05:40:36 UTC
Uploaded a patch... First time ever, hope it's correct.