-
Notifications
You must be signed in to change notification settings - Fork 184
#1130: [Win32]: Program.getImageData is broken for ".exe" extension #1131
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
4da4660 to
52b0161
Compare
Test Results 298 files - 1 298 suites - 1 8m 7s ⏱️ + 1m 29s For more details on these failures, see this check. Results for commit 5500a22. ± Comparison against base commit 103b10e. ♻️ This comment has been updated with latest results. |
|
@tmssngr : please consider to change commit message to properly refer to the original issue. Adding a line |
f95e46a to
71bd25b
Compare
|
@iloveeclipse Better now? |
71bd25b to
d893160
Compare
|
The missing |
Sure, but I mean literally: could you please add an extra line to the commit message
because this would automatically link this PR to the bug, close the bug if PR is merged and help later to navigate directly to the issue from IDE |
d893160 to
8e980bd
Compare
…exe" extension Before commit 97ca656 `SHGetFileInfo` was used initially to get the icon. This caused problems for some icons (eclipse-platform#715). The fix in commit 97ca656 removed the `SHGetFileInfo` invocation which caused a new problem that for some file extensions, e.g. `.exe`, no icon was returned any more. This fix re-introduces the `SHGetFileInfo`, but only uses it if `ExtractIconEx` did not return an icon. See: eclipse-platform#1030: eclipse-platform#1130 eclipse-platform#715: eclipse-platform#715
8e980bd to
5500a22
Compare
If you know how to get the missing icon (or maybe there are more - I just noticed it for .exe files) without the black background, you are welcome to send a pull request. I prefer to have an icon with black background instead of no icon at all. |
I have never questioned that. I just wanted to point out that this will replace one issue with another (no matter whether one is more severe than the other). The situation produced by this PR would, in my opinion, be worse than it was before #999, as then you will have some icons with proper alpha values and some with broken alpha values, making the appearance even more inconsistent and making it even more difficult to analyze the issue. Furthermore, you have already pointed to the original issue #715, in which I had proposed an alternative solution. We just preferred the solution in #999 because it was the cleaner one and we did not find the regression addressed here when validating that approach. So I would prefer to analyse whether we should not better revert #999 and implement the alternative solution, which was shown in #998, instead. To this end, I did some rundimentary analyses on the performance of the different solutions. I created an image out the program's image data 10k times, once for an image that can be retrieve via final Display display = new Display();
final Program program = Program.findProgram(".pptx");
long startTime = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
ImageData data = program.getImageData();
Image image = new Image(display, data);
image.dispose();
}
long endTime = System.currentTimeMillis();
System.out.println("Took: " + (endTime-startTime));Results (average of 5 runs):
So in terms of performance, completeness and cleanness of the solution, I would propose to revert #999 and try #998 instead. |
I'm somewhat wary of changes to the |
No objections. For me the black background did not matter much, but the missing icon did. So my patch fixed that. If you have a solution that is better than mine, also addressing the black background, feel free to share. |
I understand the concern, as SWT code is badly tested and so there is a higher risk that regressions will show up later (see the issue addressed in this PR, the GC fix issue you found just before 2024-03 release etc.). But if we took that as an argument against making changes, SWT would completely get stuck in the current state. I have created PR #1138 that replaces #999 with #998, as an alternative to this PR with the reasons given above. |
|
What kind of unit tests we could make for this code? Check that we receive an image at all. Would it make sense to verify the size of the image or its content? The content might change (seldom) depending on the Windows version or installed software. Could the size depend on the screen configuration/zoom factors? |
|
Please see my comment regarding this pr in |
|
Can this be closed now as we have #1138? |



Use previous code to retrieve icon with SHGetFileInfo if ExtractIconEx did not return one