Canvas: Set pointers to NULL instead of calling .release()
The Canvas camera and texture get recreated in several circumstances. Calling .release() on a ref_ptr will just return the raw pointer and 'delete' won't be called. The proper way to explicitly delete an object managed by a ref_ptr is to set the ref_ptr to NULL. This will delete it as long as it's not referenced by any other ref_ptr.
This commit is contained in:
parent
5fe527a2d1
commit
44bae773a0
@ -298,8 +298,8 @@ namespace canvas
|
||||
{
|
||||
if( camera.valid() && Canvas::getSystemAdapter() )
|
||||
Canvas::getSystemAdapter()->removeCamera(camera.get());
|
||||
camera.release();
|
||||
texture.release();
|
||||
camera = nullptr;
|
||||
texture = nullptr;
|
||||
|
||||
_flags &= ~AVAILABLE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user