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 626336 - Warning when activating GtkButton outside of an event handler
Warning when activating GtkButton outside of an event handler
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.90.x
Other Linux
: Normal major
: 3.0
Assigned To: gtk-bugs
Federico Mena Quintero
: 621755 632178 636382 640053 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-08-07 20:52 UTC by Gert Kulyk
Modified: 2011-02-24 22:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bgo#626336 - Don't assume that GtkButton is activated only when a keyboard event is available (2.16 KB, patch)
2011-01-21 19:33 UTC, Federico Mena Quintero
none Details | Review

Description Gert Kulyk 2010-08-07 20:52:26 UTC
Since the merge of the xi2-for-master branch you are no longer able to accept a selection in a GtkFileChooserDialog using a double click on the file. Now you are forced to press enter on the keyboard or to click on the dialog's button, what is a regression.

You can easily test it with the testfilechooser test in gtk source directory, which if started via terminal gives you the reason why it fails: 

gtk_real_button_activate: assertion `device && device->source == GDK_SOURCE_KEYBOARD'

which means the statement
g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD);
in gtk_real_button_activate() found in gtk/gtkbutton.c is causing a doubleclick to fail because it is an event from a pointing device.

I've assigned the report to the GtkFileChooser component, because only there I found a regression due to this change, but I'm not that familiar with the internals of the gtk-code to be able to decide if this is something to be fixed in gtkfilechooser, gtkbutton, or elsewhere.
Comment 1 Alberto Garcia 2010-10-07 23:07:08 UTC
I can't reproduce this bug with the latest master, can you please verify it again? Thanks!
Comment 2 Matthias Clasen 2010-11-01 18:54:50 UTC
This was fixed in commit bddb72476c343a0a62ea29d6dd3670eff16293c7
Comment 3 Federico Mena Quintero 2011-01-21 19:00:05 UTC
This is still happening; I'll reopen.
Comment 4 Federico Mena Quintero 2011-01-21 19:00:18 UTC
*** Bug 632178 has been marked as a duplicate of this bug. ***
Comment 5 Federico Mena Quintero 2011-01-21 19:00:52 UTC
*** Bug 640053 has been marked as a duplicate of this bug. ***
Comment 6 Federico Mena Quintero 2011-01-21 19:01:02 UTC
*** Bug 621755 has been marked as a duplicate of this bug. ***
Comment 7 Federico Mena Quintero 2011-01-21 19:13:55 UTC
Here is the backtrace.

  • #0 g_log
    at gmessages.c line 576
  • #1 g_return_if_fail_warning
  • #2 gtk_real_button_activate
    at gtkbutton.c line 1869
  • #3 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 79
  • #4 g_type_class_meta_marshal
    at gclosure.c line 878
  • #5 g_closure_invoke
    at gclosure.c line 767
  • #6 signal_emit_unlocked_R
    at gsignal.c line 3182
  • #7 g_signal_emit_valist
    at gsignal.c line 2983
  • #8 g_signal_emit
    at gsignal.c line 3040
  • #9 gtk_widget_activate
    at gtkwidget.c line 5974
  • #10 gtk_window_activate_default
    at gtkwindow.c line 2195
  • #11 file_chooser_widget_response_requested
    at gtkfilechooserdialog.c line 240
  • #12 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 79
  • #13 g_closure_invoke
    at gclosure.c line 767
  • #14 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #15 g_signal_emit_valist
    at gsignal.c line 2983
  • #16 g_signal_emit_by_name
    at gsignal.c line 3077
  • #17 delegate_response_requested
    at gtkfilechooserembed.c line 118
  • #18 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 79
  • #19 g_closure_invoke
    at gclosure.c line 767
  • #20 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #21 g_signal_emit_valist
    at gsignal.c line 2983
  • #22 g_signal_emit_by_name
    at gsignal.c line 3077
  • #23 file_exists_get_info_cb
    at gtkfilechooserdefault.c line 8300
  • #24 query_info_callback
    at gtkfilesystem.c line 864
  • #25 g_simple_async_result_complete
    at gsimpleasyncresult.c line 747
  • #26 complete_in_idle_cb_for_thread
    at gsimpleasyncresult.c line 812
  • #27 g_idle_dispatch
    at gmain.c line 4536
  • #28 g_main_dispatch
    at gmain.c line 2440
  • #29 g_main_context_dispatch
    at gmain.c line 3013
  • #30 g_main_context_iterate
    at gmain.c line 3091
  • #31 g_main_loop_run
    at gmain.c line 3299
  • #32 gtk_main
    at gtkmain.c line 1267
  • #33 main
    at testfilechooser.c line 698

These days, gtk_real_button_activate() does this:

gtk_real_button_activate (GtkButton *button)
{
  GtkWidget *widget = GTK_WIDGET (button);
  GtkButtonPrivate *priv;
  GdkDevice *device;
  guint32 time;

  priv = GTK_BUTTON_GET_PRIVATE (button);
  device = gtk_get_current_event_device ();

  if (device && device->source != GDK_SOURCE_KEYBOARD)
    device = gdk_device_get_associated_device (device);

  g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD);

  ...

But when we enter the function, "device" is null as there is no current device.  The file chooser code did this:

1. Get an Enter in the filename entry
2. Complicated code with async callbacks to fetch file info
3. "oh, we must activate the Open button in the file chooser"
4. filechooser -> gtk_window_activate_default() -> signal -> gtk_real_button_activate()

Since we came from an async callback, there is no current event's device.

I think GtkButton could just say, "oh, I've been activated programmatically, not directly from an event".  Will post a patch for this.
Comment 8 Federico Mena Quintero 2011-01-21 19:33:31 UTC
Created attachment 178995 [details] [review]
bgo#626336 - Don't assume that GtkButton is activated only when a keyboard event is available

Buttons may also be activated at any time from gtk_widget_activate()
or related functions.  In that case, just do the 'show the button
as pushed for a short amount of time' trick, but don't actually
try to grab the keyboard device.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
Comment 9 Federico Mena Quintero 2011-01-21 21:34:38 UTC
Fixed in commit d07231cb7aad19b94f52e9a8af768a6c39919e6d
Comment 10 Federico Mena Quintero 2011-02-24 20:59:13 UTC
*** Bug 636382 has been marked as a duplicate of this bug. ***
Comment 11 Adam Williamson 2011-02-24 22:05:01 UTC
thanks for the fix.