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

Make texture=, shader= setters work on Weak* types #96

Closed
planetis-m opened this issue Dec 25, 2023 · 7 comments
Closed

Make texture=, shader= setters work on Weak* types #96

planetis-m opened this issue Dec 25, 2023 · 7 comments

Comments

@planetis-m
Copy link
Owner

Somehow tmp are not sinked into the setter and a destructor call is generated in the outer scope.

@planetis-m
Copy link
Owner Author

planetis-m commented Dec 26, 2023

Right that was done on purpose in order to be able to share resources, however this design hits a limit with temporaries. the fix isn't obvious.

@planetis-m

This comment was marked as off-topic.

@planetis-m
Copy link
Owner Author

It actually makes sense for these setters to only accept Weak* counterparts making it explicit that they are unmanaged resources.

@planetis-m
Copy link
Owner Author

planetis-m commented Dec 26, 2023

On the other hand, it's not a weak resource, UnloadMaterial unloads both shader and all the textures... But if part of a Model, then it's not destroyed...

@planetis-m planetis-m reopened this Dec 26, 2023
@planetis-m planetis-m changed the title Memory management is broken for setters Make texture=, shader= setters work on Weak* types Dec 26, 2023
@planetis-m
Copy link
Owner Author

planetis-m commented Dec 26, 2023

I am going full circle here, that's what the repo used in 88cd872 that's a year ago!

@planetis-m
Copy link
Owner Author

Also review getShapesTexture and getFontDefault.

@planetis-m
Copy link
Owner Author

planetis-m commented May 20, 2024

The solution here is to make a setter with parameter constraints that disallow rvalues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant