diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-14 07:33:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 07:33:46 +0100 |
commit | 8bcceee94cad2a6f5a0a9b1a817f23c75e49241a (patch) | |
tree | 026fe1670bf635486d9172be0d72859084307def | |
parent | 6dae536f6cb8adce8674a161d8d73c413cbf1a6e (diff) | |
parent | 72e6369a8145853952a46a19c0025f93240f7548 (diff) |
Merge pull request #36203 from timothyqiu/nav-polygon-leak
Fixes memory leak in NavigationPolygon
-rw-r--r-- | scene/2d/navigation_polygon.cpp | 7 | ||||
-rw-r--r-- | scene/2d/navigation_polygon.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index c40cdb4720..21b2bede05 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -363,8 +363,11 @@ void NavigationPolygon::_bind_methods() { NavigationPolygon::NavigationPolygon() : rect_cache_dirty(true), - navmesh_generation(NULL) { - navmesh_generation = Mutex::create(); + navmesh_generation(Mutex::create()) { +} + +NavigationPolygon::~NavigationPolygon() { + memdelete(navmesh_generation); } void NavigationPolygonInstance::set_enabled(bool p_enabled) { diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h index 92cfc8f5e6..8d3d8543c4 100644 --- a/scene/2d/navigation_polygon.h +++ b/scene/2d/navigation_polygon.h @@ -91,6 +91,7 @@ public: Ref<NavigationMesh> get_mesh(); NavigationPolygon(); + ~NavigationPolygon(); }; class Navigation2D; |