|NSImage invalid memory access [message #991239]
||Tue, 18 December 2012 00:11
| Edu Garcia
Registered: September 2011
In Mac OSX (Lion) I'm trying to use named images with NSImage.imageNamed(). Getting the image works, as I can read the details, size, etc.
But when I try to use the image on a toolbar item or TreeItem, I get an "Invalid memory access of location 0x18 rip=0x7fff96bf3350", with different addresses depending on the image.
The thing is, trying with "NSDescendingSortIndicator" or "NSAscendingSortIndicator" works fine! But if I try to use "NSActionTemplate" or "NSAction" for example, I get the mentioned error.
This is the relevant part of my code, although I don't think I'm doing anything fancy:
NSImage nsImage = NSImage.imageNamed(NSString.stringWith("NSActionTemplate"));
Image imgActionTemplate = Image.cocoa_new(display, SWT.ICON, nsImage);
I've also noticed than I can get the image working if I do:
Image img2 = new Image(display, imgActionTemplate.getImageData())
... but in this case, I get a black image, and not an image with template behaviour (automatic graying / highlighting, etc), of course
Also, I don't know if there is other way of getting named images without OSX specific code.
Thanks in advance!
Powered by FUDForum
. Page generated in 0.01695 seconds