| From | Sent On | Attachments |
|---|---|---|
| Sami Nopanen | Nov 1, 2009 1:08 pm | |
| Paul Loy | Nov 1, 2009 2:06 pm | |
| Sami Nopanen | Nov 1, 2009 2:18 pm | |
| Andrew Thompson | Nov 1, 2009 3:25 pm | |
| Sami Nopanen | Nov 1, 2009 4:12 pm | |
| Sami Nopanen | Nov 6, 2009 8:43 am | |
| Paul Loy | Nov 6, 2009 9:00 am | |
| Sami Nopanen | Nov 6, 2009 11:44 am | |
| Duncan McGregor | Nov 6, 2009 3:12 pm | |
| Andrew Thompson | Nov 6, 2009 8:00 pm | |
| Sami Nopanen | Nov 6, 2009 8:51 pm | |
| Andrew Thompson | Nov 7, 2009 7:56 am | |
| Sami Nopanen | Nov 7, 2009 9:07 am |
| Subject: | Re: Invalid memory access of location... | |
|---|---|---|
| From: | Sami Nopanen (snop...@gmail.com) | |
| Date: | Nov 6, 2009 8:43:21 am | |
| List: | net.java.dev.rococoa.users | |
I seem to have gotten my screenshot code to become stable. I did this by getting the bitmap data through ApplicationServices framework, instead of through NSBitmapImageRep. Unfortunately, I still don't understand why the old code did not work, so if anyone figures it out, I'd be interested.
The new code is below.
Sami
private Screenshot _getScreenshot(int windowId) { NSRect nullRect = new NSRect(new NSPoint(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY), new NSSize(0, 0));
ID imageRef = QuartzLibrary.INSTANCE.CGWindowListCreateImage(nullRect, QuartzLibrary.kCGWindowListOptionIncludingWindow, windowId, QuartzLibrary.kCGWindowImageBoundsIgnoreFraming);
long width = AppLibrary.INSTANCE.CGImageGetWidth(imageRef); long height = AppLibrary.INSTANCE.CGImageGetHeight(imageRef); long bytesPerRow = AppLibrary.INSTANCE.CGImageGetBytesPerRow(imageRef);
ID nsdataRef = AppLibrary.INSTANCE.CGDataProviderCopyData(AppLibrary.INSTANCE.CGImageGetDataProvider(imageRef)); Foundation.cfRelease(imageRef); NSData nsdata = Rococoa.wrap(nsdataRef, NSData.class, false);
byte[] data = new byte[nsdata.length()]; nsdata.getBytes(data);
return new Screenshot(width, height, bytesPerRow, data); }
On Sun, Nov 1, 2009 at 7:13 PM, Sami Nopanen <snop...@gmail.com> wrote:
I get a popup of the Apple error reporting tool, with some the following dump. Also, attaching the latest version of the source I've been using for trying to isolate this. The dump is from this version.
Sami





