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 read access violation in the bitmapfont demo #583

Closed
wants to merge 1 commit into from
Closed

Fix read access violation in the bitmapfont demo #583

wants to merge 1 commit into from

Conversation

skaarj1989
Copy link
Contributor

The font_interface should be cleared before Rml::Shutdown
A valid render_interface (non nullptr) is required for unloading TextureResource in the font_interface

@mikke89 mikke89 added bug Something isn't working samples labels Jan 23, 2024
@mikke89
Copy link
Owner

mikke89 commented Jan 23, 2024

Thank you! I've been keeping a note on this bug for too long now.

However, I'm not sure if this is a sufficient fix. Since we keep a reference to the font interface inside RmlUi until shutdown, we easily risk use-after free here. Plus, it breaks the shutdown in reverse initialization order, which is a good idiom to follow.

If you look at the Rml::Shutdown procedure, you can see the appropriate shutdown order for the default interface. Ideally we would have the same order for the bitmap font engine. Any ideas?

@mikke89 mikke89 closed this in 64b36dc Feb 3, 2024
@skaarj1989 skaarj1989 deleted the bugfix branch February 3, 2024 15:45
@mikke89
Copy link
Owner

mikke89 commented Feb 3, 2024

I resolved this issue a bit differently: 64b36dc.

Thanks for reporting and the suggested solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants