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

Assertion failed when removing context-specific render interface after calling Rml::RemoveContext() #703

Open
maxamula opened this issue Oct 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@maxamula
Copy link

In one of the recent updates, support was added for assigning a render interface to each context in RmlUI. I encountered an issue when dynamically creating and later deleting a custom render interface tied to a specific context.

Steps to Reproduce:

Create a custom render interface class.
Create an instance of render interface dynamically.
Create a context that uses this custom render interface.
After completing work with the context, call Rml::RemoveContext() to delete the context.
Attempt to delete the custom render interface that was tied to this context.

Expected Behavior:

The render interface should no longer be in use after the context is removed, and it should be safe to delete it without waiting for a global RmlUi::Shutdown().

Actual Behavior:

An assertion failed error is triggered, indicating that the render interface may still be in use by RmlUI operations, and suggesting to wait for global shutdown via RmlUi::Shutdown(). However, this render interface is not global and was only used for operations on a specific context.

image

@mikke89 mikke89 added the bug Something isn't working label Oct 19, 2024
@mikke89
Copy link
Owner

mikke89 commented Oct 19, 2024

Oh I see. Yeah, looks like we lost this ability during some of the larger changes for RmlUi 6.0. There is a lifetime annotation note about having to call Rml::ReleaseTextures also before destroying the render interface, but I think there's a separate issue on the library side here. I'll take a closer look at it.

mikke89 added a commit that referenced this issue Oct 19, 2024
@mikke89
Copy link
Owner

mikke89 commented Oct 20, 2024

I pushed some changes to master now that (hopefully) make this work again. I also added a test for it, so we know about any future regressions.

You will have to manually call into Rml::ReleaseRenderManagers after removing the context, before you're allowed to erase the render interface. But you no longer need to call Rml::ReleaseTextures.

It would be great if you could test this. There could still be some more complicated situations that needs some more work, but hopefully you should hit an error or assertion in that case. Let me know how it works out for you.

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

No branches or pull requests

2 participants