Closed Bug 546387 Opened 13 years ago Closed 6 years ago

Gtk-CRITICAL gtk_clipboard_set_with_data: assertion `targets != NULL' failed with xul:label -moz-user-select: text


(Core :: DOM: Selection, defect, P1)




Tracking Status
firefox55 --- fixed


(Reporter: arno, Assigned: chutten)


(Blocks 1 open bug)


(Keywords: testcase)


(2 files)

when clicking on a <xul:label/> with -moz-user-select: text style and a value attribute*, a GTK-CRITICAL error is displayed in console:
(xulrunner-bin:5514): Gtk-CRITICAL **: gtk_clipboard_set_with_data: assertion `targets != NULL' failed

*: if label text is set as text node child, that error does not display
Attached file testcase
attachment: click on "label" text, gtk-critical is displayed in console (xterm)
Keywords: testcase
Summary: Gtk-CRITICAL with xul:label -moz-user-select: text → Gtk-CRITICAL gtk_clipboard_set_with_data: assertion `targets != NULL' failed with xul:label -moz-user-select: text
aTransferable->FlavorsTransferableCanExport is returning flavors with
zero count, because bIsPlainTextContext is true in SelectionCopyHelper but
textBuffer is empty.
We can make nsClipboard::SetData() more robust and return an error when there is nothing to put on the selection, but it is odd to call SetData with no data.
Component: Widget: Gtk → Selection
QA Contact: gtk → selection
Blocks: 632025
I get this triggering when I click in div.spacer on the new start page.
(In reply to John Drinkwater (:beta) from comment #6)
> I get this triggering when I click in div.spacer on the new start page.

Filed bug 781788 on that, it may be a duplicate of this one, because gtk_clipboard_set_with_data and IA__gtk_clipboard_set_with_data seem to be something like synonyms.
Blocks: 781788
Have same message "Gtk-CRITICAL **: gtk_clipboard_set_with_data: assertion 'targets != NULL' failed" when open in-content Preferences->Advanced->Data Choices.
Nightly 2015-08-14 Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
Is this manifestation of same bug, or I should file new bug on this?
Likely the same bug.
I'm seeing this same bug on Linux Mint 17.2 + FF 41.0.2

There is no user interaction happening at all - it usually crashes when I am away from keyboard or at night.  Relevant output from before crash:

(firefox:22892): Gtk-CRITICAL **: IA__gtk_clipboard_set_with_data: assertion 'targets != NULL' failed
Segmentation fault
I'm seeing this as well while using Ubuntu 16.04.1 LTS x64 under a VM. The following error is being displayed under the terminal when going through the STR mentioned below:

(firefox:7149): Gtk-CRITICAL **: gtk_clipboard_set_with_data: assertion 'targets != NULL' failed

The following error also appears in the browser console while using fx50.0a2 (m-a):

TypeError: engineList.view is null search.js:114:17

STR: (example of the issue:

* launch the latest version of either m-c or m-a
* open about:preferences
* rapidly click through all the menu's on the left hand side
* you'll eventually see the above errors under the terminal

Builds Used:
* fx51.0a1 (m-c), buildId: 20160824030337, changeset: bd7645928990
* fx50.0a2 (m-a), buildId: 20160824004001, changeset: a72bfbdf5c9b
Simpler STR:

* launch fx (m-c in this case)
* go into about:preferences#search
* click on the "Show search suggestions in location bar results"

You'll see the errors in the terminal, and in the browser console if you're using m-a.
Comment on attachment 8871826 [details]
bug 546387 - Don't try to set the GTK clipboard with null items

::: widget/gtk/nsClipboard.cpp:241
(Diff revision 1)
> -    
> +
>      // Get GTK clipboard (CLIPBOARD or PRIMARY)
>      GtkClipboard *gtkClipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
> -  
> +
>      gint numTargets;
>      GtkTargetEntry *gtkTargets = gtk_target_table_new_from_list(list, &numTargets);
> -          
> +

Please no whitespace changes on otherwise unchanged lines, as our history tools are not in general good enough to ignore this.

::: widget/gtk/nsClipboard.cpp:249
(Diff revision 1)
> -    if (gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets, 
> -                                    clipboard_get_cb, clipboard_clear_cb, this))
> +    if (gtkTargets && gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets,
> +                                                  clipboard_get_cb, clipboard_clear_cb,
> +                                                  this))

Please either add a line break at && or re-wrap the arguments to stay within 80 columns.

::: widget/gtk/nsClipboard.cpp:268
(Diff revision 1)
>              gtk_clipboard_set_can_store(gtkClipboard, gtkTargets, numTargets);
>          }
>          rv = NS_OK;
>      }
> -    else {  
> +    else {

Similarly about whitespace.
Attachment #8871826 - Flags: review?(karlt) → review+
Pushed by
Don't try to set the GTK clipboard with null items r=karlt
Assignee: nobody → chutten
Priority: -- → P1
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Here's a bug for you, though this one doesn't seem to be seven years old: every time this thread gets updated, I receive a notification - despite the fact that I do not recall signing up to the thread, or contributing to it, and despite the fact that the follow button at the top of this page seems to indicate that I am not following the but. Also, the e-mail I get contains this:

------- You are receiving this mail because: -------

*Sic*, i.e. there's no text following. 

I am sorry to be grouchy, but I have bugs filed against Thunderbird that aren't getting fixed, and now I'm getting told - repeatedly - about a bug I have no involvement in!
That must be frustrating. Let's see if I can help.

Step 1 might be to verify which email address these pieces of bugmail are being sent to. Is it the one you're using for bugzilla, or are you being forwarded email from another account?

Step 2 is what you've already done: check for that email address in the Cc and Reporter fields of a bug.

Step 3 would be to check that email's bugzilla preferences to see if you are watching this Component. (The dropdown at the top of the page with your email address on it > Preferences > Component Watching). There's a section "You are currently watching". Ensure that doesn't have "Core __Any__" or "Core Selection" in it.

Step 4 is to check the general Email Preferences (from the Preferences screen select "Email Preferences"). Anything in the section "I want to receive email when" is interesting. I don't think you're the QA Contact, but maybe you voted for this bug at one point? Or maybe you are watching a user (the section below the table) who is involved in this bug.

All else fails, at the bottom of this bug is a list of bugs you are ignoring. You can add this bug to it and never hear from it again, regardless of why.

I hope this helps. If not, might be able to look into things from within.
You need to log in before you can comment on or make changes to this bug.