Riccardo Mottola wrote:
Hi,
I did a file-frmat change in Graphos: colors are nov saved,
represented and copy&pasted using RGB and not CMYK as it was using
as a "GDraw derivative".
Everything appears to work on Mac.
I have problems with copy&paste with Graphos on GNUstep when
copy&pasting text objects. All other objects do work, TextObjects
are not that different (except for some information which did NOT
change. copy&paste did work before...). At the first copy&paste
nothing happens... afterwards the program may become unstable and
crash.
Can you help figuring out+ I thought about exceptions, but non is
raised.
I don't say it is a GS bug, it could be an error in Graphos about
which Mac is more lenient...
It is certainly not a GS bug. Running Graphos with GNUstep under OS X
I got a nice crash report when attempting to paste a text object:
Thread 0 Crashed:
0 libobjc-gnu.3.dylib 0x0007cf2c objc_msg_lookup + 76
1 libgnustep-base.1.24.dylib 0x00f14310 GSIMapAddPair + 360
(GSIMap.h:1087)
2 libgnustep-base.1.24.dylib 0x00f15418 -[GSDictionary
initWithObjects:forKeys:count:] + 912 (GSDictionary.m:220)
3 libgnustep-base.1.24.dylib 0x0103dbc0 +[NSDictionary
dictionaryWithObjectsAndKeys:] + 980 (NSDictionary.m:539)
4 Graphos 0x000219c4 -[GRText draw] + 1108
(GRText.m:465)
5 Graphos 0x00018a08 -[GRDocView drawRect:] +
1736 (GRDocView.m:1662)
Given that Graphos crashes in a function like GSIMapAddPair, the most
likely cause is a memory corruption. Looking at the code in GRText I
see three objects passed to -dictionaryWithObjectsAndKeys:. Two of
them, temp and style, are assigned locally in the -draw method and
third is the attribute strokeColor. Now looking at the code of -
initFromData:inView:zoomFactor:, which is the initializer used for
pasted objects, I see that the strokeColor attribute is assigned an
autoreleased color object. Retaining this object will avoid the crash
(and FWIW, the same error is present for the fillColor attribute).
This code works on OS X either because Cocoa is returning a
preallocated color (you might try whether copying a text object with
some non-standard color works) or because Cocoa uses a cache of color
objects.
Wolfgang
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev