-
Notifications
You must be signed in to change notification settings - Fork 1
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
SDL_Renderer改变引起的SDL_Texture失效问题 #3
Comments
Kiritow
added a commit
that referenced
this issue
Apr 20, 2017
Fix issue #3: class Texture has a shared_ptr to weak_ptr. The weak_ptr observes a shared_ptr in a list in class Window. When Window::setRenderer is called, Textures will be released and the previous renderer is also release. Then a new renderer is created. User should reload textures by themselves.
这个问题在这个提交中被解决~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
测试代码如下
根据当前情况,nrnd的建立会导致rnd的失效,此时rnd渲染的t和b都处于无效状态(Invalid Texture).
解决这个问题可以将Texture中的指针改为weak_ptr,并将真正的Texture放入Window类中. 但是这样的话又不能在Texture超出作用域的时候自动释放(因为都保存在Window里了),这样很有可能引起内存暴涨...
The text was updated successfully, but these errors were encountered: