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 651224 - null pointer dereferenced due to multiple bugs in gtkclipboard-quartz.c
null pointer dereferenced due to multiple bugs in gtkclipboard-quartz.c
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
3.1.x
Other Mac OS
: Normal major
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-05-27 09:15 UTC by Dmitry Leontiev
Modified: 2013-09-28 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dmitry Leontiev 2011-05-27 09:15:34 UTC
gtk_clipboard_wait_for_contents() returns GtkSelectionData with display member set to 0;
I've fixed copying and pasting of text by adding the following lines in gtk_clipboard_wait_for_contents():

      selection_data = g_slice_new0 (GtkSelectionData);
      selection_data->selection = clipboard->selection;
      selection_data->target = target;
      //FIX: set display!!!!!
      selection_data->display=clipboard->display;

and

  selection_data = _gtk_quartz_get_selection_data_from_pasteboard (clipboard->pasteboard,
								   target,
								   clipboard->selection);
  //FIX: set display!!!!!
  if(selection_data)selection_data->display=clipboard->display;

and now I can copy&paste plain text. However, clipboard demo in gtk3-demos crashes with bus error when I try to drag-and-drop an image.
Comment 1 Dmitry Leontiev 2011-05-30 12:59:15 UTC
another bug in gtkdnd-quartz.c

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000014
0x006c605a in gtk_style_context_save (context=0x14) at gtkstylecontext.c:1727
1727	  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
(gdb) p context
$1 = (GtkStyleContext *) 0x14
(gdb) bt
  • #0 gtk_style_context_save
    at gtkstylecontext.c line 1727
  • #1 gtk_drag_highlight_draw
    at gtkdnd-quartz.c line 352
  • #2 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 85
  • #3 gtk_widget_draw_marshaller
    at gtkwidget.c line 800

code in gtkdnd-quartz.c near line 352:
  GtkStyleContext *context;

  gtk_style_context_save (context);
Comment 2 John Ralls 2011-10-09 19:02:51 UTC
The second issue, the crash, was fixed with 7cff8c44.

What exactly is the problem with having the display set to zero with Quartz? Quartz doesn't support multiple displays. I'm able to use the clipboard without trouble.
Comment 3 Dmitry Leontiev 2011-10-10 09:14:42 UTC
quartz supports only one display, but gdk needs this display, not NULL

if display is NULL, you will see critical warnings in log: "assertion GTK_IS_DISPLAY(display) failed", and you copy&paste will not work.
Comment 4 John Ralls 2011-10-10 14:13:45 UTC
Well, yes, in theory. The catch is that selection_data.display isn't used anywhere in the quartz code. 

It is filled in in most instances (including gtk_quartz_get_selection_data_from_pasteboard(), so your second insertion isn't necessary), so I suppose for completeness we can add it to the TARGETS case as you've proposed.
Comment 5 Timothy Arceri 2013-09-28 12:20:07 UTC
Can this bug be closed?
Comment 6 John Ralls 2013-09-28 17:59:36 UTC
Yes. I added setting the settings->display to the special case in gtk_selection_wait_for_display() in mater: 124e814