Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) - SOLVED((kCGErrorCannotComplete: CGSDeviceSynchronize: Invalid device window))
Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) - SOLVED [message #490795] |
Sat, 10 October 2009 21:23 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi, everybody,
I've encountered a strange problem with Mac OS X 10.6 and SWT 3.5. When my SWT application recreates a Composite with its children, I get the following error in the console window:
Mac-Pro.local java[382] <Error>: kCGErrorCannotComplete: CGSDeviceSynchronize: Invalid device window
This error is printed out many times per second while the application seems to be running on fine without any problems.
I have never experienced these problems before upgrading to Mac OS X 10.6 and the code of my application hasn't changed since the upgrade. This is clearly not a SWT issue, so I don't have a clue how to address it.
Is it possible that Apple JVM has issues with the new Snow Leopard?
Any help, hint or idea regarding this error would be greatly appreciated.
Best regards,
Albert
[Updated on: Wed, 21 October 2009 08:02] Report message to a moderator
|
|
|
Re: Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) [message #491134 is a reply to message #490795] |
Tue, 13 October 2009 12:40 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
It seems that this is really some exotic kind of error, since I haven't found anything informative on the Internet regarding this problem.
Even googleing for just "CGSDeviceSynchronize: Invalid device window" returns only about 10 hits.
But I can confirm now that this error doesn't occur on Leopard 10.5.6, while I managed to reproduce it without problems on two other Macs running Snow Leopard.
I'm not very experienced Mac user myself, so I really don't have an idea what is going on here.
Best regards,
Albert
[Updated on: Tue, 13 October 2009 12:40] Report message to a moderator
|
|
| |
Re: Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) [message #491340 is a reply to message #491215] |
Wed, 14 October 2009 08:28 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi, Grant,
thank you for your reply!
I'm afraid I cannot provide a snippet, because the critical part of code is too complex to be just "pulled out" of my application. But basically, my application opens another shell, which is being updated from the UI thread and closed afterwards. Then a composite inside my main shell is recreated and this is the point when the above mentioned error gets printed in the Console. I have also built a jar file and run it from Terminal application, which gives the exactly same result.
No, I'm using pure SWT and not using SWT_AWT bridge, not using JFace etc.
I tried to run my application in 32-bit mode too, using 32-bit cocoa SWT library, but result is the same. On the other hand, I have no such problems on Mac OS 10.5.x. The application also runs fine on Linux and on Windows.
I also forgot to include the second line of this "stack trace" in my first post, which is:
Wed Oct 14 10:07:21 Mac-Pro.local java[1423] <Error>: kCGErrorCannotComplete: CGSDeviceSynchronize: Invalid device window
Second line:
Wed Oct 14 10:07:21 Mac-Pro.local java[1423] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Wed Oct 14 10:07:21 Mac-Pro.local java[1423] <Error>: kCGErrorCannotComplete: CGSDeviceSynchronize: Invalid device window
After this, the last error is, as said, repeated ad infinitum, while the application is still running as expected.
Even if this printing of error doesn't affect the performance of application, it's still very annoying.
Thanks again for your help, have a nice day,
Albert
[Updated on: Wed, 14 October 2009 08:29] Report message to a moderator
|
|
|
Re: Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) [message #492028 is a reply to message #490795] |
Sat, 17 October 2009 09:11 |
Albert Pikus Messages: 70 Registered: October 2009 |
Member |
|
|
Hi, Grant,
I have discovered what is causing this error to be printed into console. I also have a simple "about shell" in my application, where I'm using GC in order to measure the width of some label on this shell, like this:
GC gc = new GC(infoLabel);
Point pt = gc.textExtent(infoLabel.getText());
When about shell is created and when I close it afterwards, this error gets printed like crazy. If I don't use GC, everything is fine and no error is printed.
I will provide a simple snippet, when I'll find some time, but basically it's very simple to reproduce this, as mentioned above.
I would like to emphasize though that this error applies only to Snow Leopard - on Leopard there is no such behavior.
Thank you for your time, regards,
Albert
|
|
| |
Re: Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) [message #492148 is a reply to message #492033] |
Mon, 19 October 2009 07:15 |
Daniel Krügler Messages: 853 Registered: July 2009 |
Senior Member |
|
|
Albert wrote:
> I have also discovered that I can avoid this error to appear if I call
> dispose() on GC when I'm finished with laying out a label (I'm using
> FormLayout), like this:
>
>
> GC gc = new GC(infoLabel);
> Point pt = gc.textExtent(infoLabel.getText());
> formData.left = new FormAttachment(infoLabel, left, SWT.LEFT);
> formData.right = new FormAttachment(infoLabel, pt.x, SWT.LEFT);
> infoLabel.setLayoutData(formData);
>
> // Explicitly call dispose gc.dispose();
>
>
> Normally this isn't required, since all the shell's children should be
> disposed automatically when shell is disposed.
>
> This is strange behavior indeed.
No, it is not: You always need to dispose a new'ed GC:
"Application code must explicitly invoke the GC.dispose() method to
release the operating system resources managed by each instance when
those instances are no longer required."
You are using the constructor
public GC(Drawable drawable)
which has the explicit requirement
"You must dispose the graphics context when it is no longer required."
This seems a very strict requirement to me.
Eclipse has a very clear allocation policy here. For the same reason
you are not supposed to dispose any GC that you obtain as argument
of a specific event, like a PaintEvent event.
Greetings from Bremen,
- Daniel
|
|
| | | | |
Re: Strange error on Mac OS X 10.6 (Snow Leopard) with SWT 3.5 (Cocoa) [message #527652 is a reply to message #523870] |
Thu, 15 April 2010 23:12 |
Shane Martin Messages: 1 Registered: April 2010 |
Junior Member |
|
|
Philip Borlin wrote on Mon, 29 March 2010 12:42 | I was having the "CGSDeviceSynchronize: Invalid device window" problem when I launched a second workbench window and then closed it in my RCP app (on OS X 10.6.2) I did a search for all of my GC instantiations, found 3 that weren't disposed of properly, disposed them properly, and the error went away.
Thanks for all the legwork Albert!
|
I'm having this issue and I don't know anything about a GC or how to find them -- I'm getting this error on the launch of eclipse. Perhaps it is different? Can someone run me through this?
[Updated on: Thu, 15 April 2010 23:15] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Tue Sep 24 11:06:54 GMT 2024
Powered by FUDForum. Page generated in 0.04331 seconds
|