Browse Source

Manually merged PR #676.

Branimir Karadžić 10 years ago
parent
commit
608e038b96
1 changed files with 9 additions and 0 deletions
  1. 9 0
      examples/common/nanovg/nanovg_bgfx.cpp

+ 9 - 0
examples/common/nanovg/nanovg_bgfx.cpp

@@ -1024,6 +1024,10 @@ namespace
 			}
 		}
 
+		BX_FREE(gl->m_allocator, gl->uniforms);
+		BX_FREE(gl->m_allocator, gl->verts);
+		BX_FREE(gl->m_allocator, gl->paths);
+		BX_FREE(gl->m_allocator, gl->calls);
 		BX_FREE(gl->m_allocator, gl->textures);
 		BX_FREE(gl->m_allocator, gl);
 	}
@@ -1034,8 +1038,13 @@ NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _alloca
 {
 	if (NULL == _allocator)
 	{
+#if BX_CONFIG_ALLOCATOR_CRT
 		static bx::CrtAllocator allocator;
 		_allocator = &allocator;
+#else
+		BX_CHECK(false, "No allocator has been passed to nvgCreate(). Either specify a bx::AllocatorI instance or enable BX_CONFIG_ALLOCATOR_CRT directive.");
+		return NULL;
+#endif // BX_CONFIG_ALLOCATOR_CRT
 	}
 
 	struct NVGparams params;