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

Fix displaying icons from embedded resources #2595

Merged

Conversation

AustinWise
Copy link
Contributor

Problem

When BitmapCacheOption.None is used, icons will not be loaded from the
stream until they are needed to be displayed. In this case, the icon
loading will be triggered when the text box is rendered from the UI thread.
However by that time the steam object will have already been disposed.
This results in no icons being visible.

Solution

The fix is to eager load the icons while the stream is still alive.

An alternative fix would be to defer disposing the stream to a later time
or not dispose it at all.

When BitmapCacheOption.None is used, icons will not be loaded from the
stream until they are needed to be displayed. In this case, the icon
loading will be triggered when the text box is rendered from the UI thread.
However by that time the steam object will have already been disposed.
This results in no icons being visibile.

The fix is to eager load the icons while the stream is still alive.

An alterntive fix would be to defer disposing the stream to a later time
or not dispose it at all.
@AustinWise AustinWise changed the title Fix loading icons embedded as resources. Fix loading icons embedded from resources. Dec 31, 2021
@AustinWise AustinWise changed the title Fix loading icons embedded from resources. Fix displaying icons from embedded resources Dec 31, 2021
@siegfriedpammer
Copy link
Member

Thank you for your contribution!

@siegfriedpammer siegfriedpammer merged commit 0f57720 into icsharpcode:master Dec 31, 2021
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.

2 participants