Fix SubViewport/AudioStreamPlayer2D crash
Updated Viewport destructor to remove itself from World2D, to avoid World2D keeping invalid pointers.
This commit is contained in:
parent
8120e0324a
commit
7a9acd5aca
|
@ -5048,6 +5048,9 @@ Viewport::~Viewport() {
|
|||
for (ViewportTexture *E : viewport_textures) {
|
||||
E->vp = nullptr;
|
||||
}
|
||||
if (world_2d.is_valid()) {
|
||||
world_2d->remove_viewport(this);
|
||||
}
|
||||
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
||||
RenderingServer::get_singleton()->free(viewport);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue