Skip to content
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

[PTRun]Asynchronously load image and thumbnails #24736

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

jaimecbernardo
Copy link
Collaborator

Summary of the Pull Request

Thumbnail image loading on PowerToys Run is now done asynchronously, similar to the improvement that FlowLauncher as adopted as well.
In my tests, this fixes the #18166 dispatcher error we've been seeing so frequently for a long time.
I'm distributing a non official build as well for affected users to be able to give it a test.
This PR also removes the special case we added for Adobe Reader and pdf files.

PR Checklist

Validation Steps Performed

This error is quite hard to replicate. Best way here is just checking if PT Run still works OK and let's try to have the users give us some feedback on the issue.

@davidegiacometti
Copy link
Collaborator

Looks nice!
This may also fix the issue of icons being not loaded or loaded wrong: #19138

Comment on lines -192 to -199
else if (!generateThumbnailsFromFiles || (extension == ".pdf" && WindowsThumbnailProvider.DoesPdfUseAcrobatAsProvider()))
{
// The PDF thumbnail provider from Adobe Reader and Acrobat Pro lets crash PT Run with an Dispatcher exception. (https://github.com/microsoft/PowerToys/issues/18166)
// To not run into the crash, we only request the icon of PDF files if the PDF thumbnail handler is set to Adobe Reader/Acrobat Pro.
// Also don't get thumbnail if the GenerateThumbnailsFromFiles option is off.
type = ImageType.File;
image = WindowsThumbnailProvider.GetThumbnail(path, Constant.ThumbnailSize, Constant.ThumbnailSize, ThumbnailOptions.IconOnly);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should remove it. On my test system Adobe's provider shows always black (and broken) images in explorer.

We should keep it and maybe hide it behind a setting to enable it if Adobe thumbnails makes trouble.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be covered by "Generate thumbnails from files" disabled option as a fallback, right?

Copy link
Collaborator

@htcfreek htcfreek Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then you have no thumbnails for all types instead of only for Acrobat PDF files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Although, I'm not too fond of the idea of keep adding these exceptional cases. I guess we can keep covering this one as AdobeReader is quite popular and widely used software and hopefully won't end up adding a bunch of these

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

Copy link
Collaborator

@htcfreek htcfreek left a 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. Great improvement that hopefully makes PT more stable.

@stefansjfw stefansjfw merged commit 35e8d04 into microsoft:main Mar 20, 2023
@stefansjfw
Copy link
Collaborator

Thanks for the help everyone!

BLM16 pushed a commit to BLM16/PowerToys that referenced this pull request Jun 22, 2023
* [PTRun]Asynchronously load image and thumbnails

* Bring back check for Adobe PDF generated thumbnails

---------

Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants