-
Notifications
You must be signed in to change notification settings - Fork 187
[Win32] Ensure Image#getImageData() returns no internal data #2427
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
[Win32] Ensure Image#getImageData() returns no internal data #2427
Conversation
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.
It fixes the contract "Modifications made to the returned {@code ImageData} will not affect this Image" but it breaks the other tests: test_imageDataIsCached, test_getBoundsInPixels and test_getImageDataCurrentZoom.
4f50ca9 to
baa8f49
Compare
|
@ShahzaibIbrahim I adapted |
|
@HeikoKlare I tried with your latest changes and they are not failing anymore. I cannot mark my review stale for some reason. |
A caching mechanism for ImageData introduced to some provider implementations inside the Image class leads to Image#getImageData() returning an ImageData object, which if modified affects the underlying Image. This contradicts the contract of that method, which states that changes to that object will not affect the Image. This change ensures that Image#getImagetData() only returns objects that are not used internal of the Image instance. To this end, clones of the ImageData are created where necessary.
baa8f49 to
8deabcf
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.
Change makes sense for the described regression as it will clone the ImageData when they are returned via API call. This will ensure the Image itself to be unchanged. I tested the changed with and without monitor specific scaling for regression and didn't find any.
Good to go from my side
|
Thanks @HeikoKlare! I have also verified the fix in our product. |
This fixes a regression from #1989 as reported by @sratz: #1989 (comment)
A caching mechanism for ImageData introduced to some provider implementations inside the Image class leads to Image#getImageData() returning an ImageData object, which if modified affects the underlying Image. This contradicts the contract of that method, which states that changes to that object will not affect the Image.
This change ensures that Image#getImagetData() only returns objects that are not used internal of the Image instance. To this end, clones of the ImageData are created where necessary.