Community
Participate
Working Groups
I'm developing an application using Eclipse and SWT. If I do the following on a mac, the second file has the same contents as the first one. There was a bug in SWT that was solved nearly a decade ago that was related with how swt.GC was disposed (bug 339132). But in my case it's not being disposed. It seems there's a cache being held somewhere, but I couldn't find a way to get rid of it. My code, simplified: Image myImg = new Image( Display.getDefault(), 100, 100 ); GC mygc = new GC( myImg ); // draw something // Saves the image to a file. saveImage( myImg ); // draw something else on the same image. // Saves the image to another file. saveImage( myImg ); myImg.dispose(); mygc.dispose(); If I do this after saving the first file, and before the extra drawing operations, the problem is solved: mygc.dispose(); mygc = new GC( myImg ); But I don't want to dispose and create a new GC, because of performance issues. On Windows it works perfectly.
Is it this issue? https://bugs.eclipse.org/bugs/show_bug.cgi?id=543796
Yeah, precisely! The example I put on my description comes from tests I was making, but the real problem I'm having is that our images do not get updated after being drawn on another one, just like the spinnet from the bug you linked. On my example above, as I'm testing from our RCP product, I save my file doing this: ImageLoader iLoader = new ImageLoader(); iLoader.data = new ImageData[] { image.getImageData() }; iLoader.save( Platform.getLocation().toOSString() + File.separator + Long.toString( System.currentTimeMillis() ) + ".png", SWT.IMAGE_PNG ); How can I create a snippet that saves to a file without specifying an absolute path?
*** This bug has been marked as a duplicate of bug 543796 ***