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:
Fernando García Liñán 2021-08-31 18:04:50 +02:00
parent 2371065375
commit da750c5995

View File

@ -297,8 +297,8 @@ namespace canvas
{ {
if( camera.valid() && Canvas::getSystemAdapter() ) if( camera.valid() && Canvas::getSystemAdapter() )
Canvas::getSystemAdapter()->removeCamera(camera.get()); Canvas::getSystemAdapter()->removeCamera(camera.get());
camera.release(); camera = nullptr;
texture.release(); texture = nullptr;
_flags &= ~AVAILABLE; _flags &= ~AVAILABLE;
} }