-
Notifications
You must be signed in to change notification settings - Fork 187
Create handles for ImageDataProvider and ImageFilenameProvider on demand #1898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
91c2e3b to
20ec82f
Compare
20ec82f to
592917e
Compare
fedejeanne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a NIT: width and height could be final (also in ImageGcDrawerWrapper)
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
2e3b140 to
7634852
Compare
akoch-yatta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
f768700 to
969155c
Compare
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well. Just minor comments from my side.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Show resolved
Hide resolved
969155c to
d874807
Compare
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
Outdated
Show resolved
Hide resolved
e2753b3 to
15f9c8c
Compare
fedejeanne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
The code looks fine but some tests fail because of leaked resources. I am retriggering tests. @ShahzaibIbrahim stay tuned |
Retriggering tests because of leaked resources
|
The leaks are still there so it's definitely not a fluke @ShahzaibIbrahim . Here's the stack trace: java.lang.Error: SWT Resource was not properly disposed
at org.eclipse.swt.graphics.Resource.initNonDisposeTracking(Resource.java:184)
at org.eclipse.swt.graphics.Resource.<init>(Resource.java:121)
at org.eclipse.swt.graphics.Image.<init>(Image.java:593)
at |
d793d54 to
1105003
Compare
1105003 to
a46c317
Compare
|
@fedejeanne resource leak is fixed. |

Currently, when an image is instantiated using
ImageDataProviderorImageFileNameProvider, a handle is created immediately. We aim to optimize this by deferring handle creation until it is explicitly needed. To achieve this,getBounds()will return the bounds of a 100% zoomed image when called after instantiation, without requiring a handle to be created upfront. This change improves efficiency by reducing unnecessary resource allocation during image initialization.Attaching the snippet to test the use cases after this change: