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 508601 - Copying from GTK+ applications causes crash
Copying from GTK+ applications causes crash
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-01-10 20:10 UTC by Shreevatsa R
Modified: 2011-08-01 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backtrace from running gtk+ app and copying (11.06 KB, application/octet-stream)
2008-01-10 20:12 UTC, Shreevatsa R
Details

Description Shreevatsa R 2008-01-10 20:10:39 UTC
Using <a href="http://developer.imendio.com/projects/gtk-macosx/build-instructions">GTK+ Mac OS X</a>, if I try to copy text from a GTK+ application (either by hitting Ctrl-c or clicking Copy), it causes a crash.

This is more than 95% reproducible for me, across all GTK+ apps I have tried (both those written in C and PyGTK, if that makes any difference).

I'm using GTK+ 2.15.0 on OS X 10.4.11 Intel.

I have attached a stack trace here (three backtraces in one file actually: I asked gdb to continue thrice, and the third time it did not crash but the program was working normally again till I quit it normally).

Originally <a href="http://developer.imendio.com/node/159">reported here</a>.
Comment 1 Shreevatsa R 2008-01-10 20:12:20 UTC
Created attachment 102536 [details]
backtrace from running gtk+ app and copying

Ran with:
  gdb gtk-demo
  run
  bt full
  continue
etc.
Comment 2 Richard Hult 2008-01-10 21:50:33 UTC
Thanks for the report. To summarize the forum thread: I can't reproduce on 10.4.10 ppc or 10.5 intel.

I'll try to take a closer look at this.
Comment 3 Richard Hult 2008-01-12 10:08:14 UTC
One question, are you sure it's when you press ctrl-c, and not ctrl-v? Nothing should really happen when copying, only when pasting.

Comment 4 Shreevatsa R 2008-01-12 17:08:37 UTC
Yes, it's when I copy, not when I paste. Pasting works fine (both Ctrl-v and right-click->paste).

Something clearly _is_ happening when I copy; it crashes :) [in gtk_quartz_set_selection or whatever as the trace above says]
Comment 5 Shreevatsa R 2008-01-12 17:27:38 UTC
BTW it crashes (identically) when I Cut too. Both Cut and Copy are buggy, Paste is not.
Comment 6 Richard Hult 2008-02-16 13:11:34 UTC
Could you please try latest trunk or 2.12 branch from svn? I have still not been able to reproduce your problem, but did some related fixing in that code.

Comment 7 Shreevatsa R 2008-04-12 03:37:42 UTC
Sorry for the delay...

I tried with 2.12.9, and it still crashes in the same way. Is there anything more I can do, like generate another backtrace and attach it?
Comment 8 Shreevatsa R 2008-04-12 04:15:41 UTC
Also (somewhat unrelated), my applications crash whenever I try to paste Unicode characters into them (some work, but most don't). Should I file a separate bug about this, or is it known already?
Comment 9 Richard Hult 2008-04-12 05:47:01 UTC
It's probably the same bug. What locale are you running in (run "locale" in a terminal and paste the output here), and what exact text are you trying to copy/paste?

Also please paste the output from running this in the terminal: 

defaults read .GlobalPreferences AppleCollationOrder



Comment 10 Shreevatsa R 2008-04-12 07:13:09 UTC
locale was:
~$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL="C"

(I tried setting LC_ALL to "en_US" or "en_US.UTF-8" and it didn't help; I can try changing other things if you want.)

defaults read .GlobalPreferences AppleCollationOrder says "en"
Comment 11 Richard Hult 2008-04-12 08:06:41 UTC
OK thanks. Just to make sure, can you please also give me exact detailed instructions for how to reproduce this with gtk-demo, including what exact text you are selecting etc?

Also, are there any warnings printed in the terminal when you run it?

Comment 12 Shreevatsa R 2008-04-12 13:15:40 UTC
It does not matter what text I select; it always crashes. (Sometimes it does not crash immediately, but crashes when I next interact with it, like type some text etc.)

Copying from the Source tab seems to more reliably crash it than from the Info tab, somewhat.

In the terminal I see:

2008-04-12 09:13:08.484 gtk-demo[1122] An uncaught exception was raised
2008-04-12 09:13:08.484 gtk-demo[1122] *** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: -1, maximum size: -2147483648 bytes
2008-04-12 09:13:08.484 gtk-demo[1122] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: -1, maximum size: -2147483648 bytes
zsh: trace trap  /opt/local/bin/gtk-demo

[Last line is "Trace/BPT trap" if I run it from Bash, just to make sure it's not a Zsh-specific problem.]
Comment 13 Richard Hult 2008-04-12 13:53:04 UTC
OK, thanks. Could you also run otool -L /path/to/your/prefix/bin/gtk-demo and paste the output here?

Are you sure you don't have any old/other installation somewhere of gtk+ that could interfere? Like mono or a macports build of gtk?
Comment 14 Shreevatsa R 2008-04-12 15:28:35 UTC
I don't have any other installation.

But um.. this is a macports build of gtk. The problem, stack trace, error message in the terminal etc. are identical to what building gtk+ myself were giving me (when I filed this bug), so I hope it is not important (if not, I can uninstall the macports gtk and install according to the official build instructions...)
otool -L gives:

otool -L /opt/local/bin/gtk-demo
/opt/local/bin/gtk-demo:
        /opt/local/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 1201.0.0, current version 1201.9.0)
        /opt/local/lib/libgdk-quartz-2.0.0.dylib (compatibility version 1201.0.0, current version 1201.9.0)
        /opt/local/lib/libgtk-quartz-2.0.0.dylib (compatibility version 1201.0.0, current version 1201.9.0)
        /opt/local/lib/libpangocairo-1.0.0.dylib (compatibility version 1801.0.0, current version 1801.4.0)
        /opt/local/lib/libpangoft2-1.0.0.dylib (compatibility version 1801.0.0, current version 1801.4.0)
        /opt/local/lib/libpango-1.0.0.dylib (compatibility version 1801.0.0, current version 1801.4.0)
        /opt/local/lib/libatk-1.0.0.dylib (compatibility version 2010.0.0, current version 2010.1.0)
        /opt/local/lib/libgobject-2.0.0.dylib (compatibility version 1401.0.0, current version 1401.6.0)
        /opt/local/lib/libgmodule-2.0.0.dylib (compatibility version 1401.0.0, current version 1401.6.0)
        /opt/local/lib/libglib-2.0.0.dylib (compatibility version 1401.0.0, current version 1401.6.0)
        /opt/local/lib/libcairo.2.dylib (compatibility version 14.0.0, current version 14.7.0)
        /opt/local/lib/libfontconfig.1.dylib (compatibility version 5.0.0, current version 5.0.0)
        /opt/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.16.0)
        /opt/local/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
        /opt/local/lib/libtiff.3.dylib (compatibility version 12.0.0, current version 12.2.0)
        /opt/local/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
        /opt/local/lib/libpng12.0.dylib (compatibility version 25.0.0, current version 25.0.0)
        /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.10)
        /opt/local/lib/libintl.8.dylib (compatibility version 9.0.0, current version 9.2.0)
        /opt/local/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
Comment 15 Richard Hult 2008-04-21 07:34:16 UTC
Hm, I wonder if there is a problem caused by the iconv version in macports... I don't know why they include that since the system comes with iconv. I will try to run with macports version, if I get some time to see if that causes any issues.

Comment 16 Richard Hult 2008-05-04 19:48:50 UTC
(In reply to comment #14)
> But um.. this is a macports build of gtk.

I am trying to install gtk+ quartz with macports but I can only manage to get the x11 version built... how do I get the right version installed? I did ports install gtk2 +quartz but that still pulled in X11.

Comment 17 Shreevatsa R 2008-05-04 19:54:43 UTC
Oh, was this recently? I thought this was fixed.

Does "port install gtk2 +quartz +no_x11" work?
Comment 18 Richard Hult 2008-05-04 20:49:20 UTC
Ah, that worked, thanks. I don't get any crashes though (seems like the macport is broken btw, fonts are not working).

Comment 19 Shreevatsa R 2008-05-05 03:58:50 UTC
Yes, it's broken now. Stupid MacPorts. And I upgraded to Leopard now, so I might not be able to reproduce it either... I'll report back here when I've got everything working.
Comment 20 Richard Hult 2008-05-12 11:26:54 UTC
I couldn't reproduce with a macports build either.
Comment 21 Richard Hult 2008-10-09 08:55:22 UTC
Once 2.14.4 is released, it would be good if someone that sees this crash could retest (bug #554141 might have helped).
Comment 22 Shreevatsa R 2009-01-26 22:00:14 UTC
I just tried this again, and it seems to mostly crash no longer.

Quicksilver has a clipboard history module. If I have it turned on, copying from applications frequently crashes (with the same "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: -1, maximum size: -2147483648 bytes'" message.)

If I turn it off, it seems hard or impossible to produce a crash. So I don't know if this is a bug in Quicksilver or GTK.
Comment 23 Cédric Krier 2009-05-27 09:47:04 UTC
I have the same issue when I use set_with_data function but not if I use set_text on clipboard.
Comment 24 Mikayla Hutchinson 2009-09-29 23:24:12 UTC
We are seeing this in MonoDevelop too. It seems to be caused by an application called Launchbar.

https://bugzilla.novell.com/show_bug.cgi?id=533560
Comment 25 Richard Procter 2010-08-10 08:02:57 UTC
I seem to be having the same issue. My crash only occurs with GtkTextView not GtkEntry.

Using the clipboard browser "Clipboard Viewer" included with X Code reveals that the two widgets offer different targets. Requesting STRING, TEXT, or COMPOUND_TEXT causes GTK+ 2.18.2 to crash. However GTK+ 2.20.1 handles the situation gracefully.
Comment 26 Mikayla Hutchinson 2011-07-22 11:20:02 UTC
This is caused by the clipboard utilities requesting all of the available clipboard target types from the app. The COMPOUND_TEXT, TEXT and STRING types crash when requested, but they're not actually useful on Mac anyway, so they should be removed.
Comment 28 John Ralls 2011-08-01 00:00:08 UTC
And backported to gtk-2-24: 875e6f4bdbb8f4ee02fff11febbdca425ff915b0