Bug 564977 - Internal cache being held
Summary: Internal cache being held
Status: CLOSED DUPLICATE of bug 543796
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.14   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-06 11:32 EDT by Mario Marinato CLA
Modified: 2020-07-06 16:00 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Marinato CLA 2020-07-06 11:32:42 EDT
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.
Comment 1 Andrey Loskutov CLA 2020-07-06 16:00:13 EDT

*** This bug has been marked as a duplicate of bug 543796 ***