瀏覽代碼

Fixed a minor memory leak in love.graphics.setMode.

Alex Szpakowski 10 年之前
父節點
當前提交
0bf80bb9fc
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/modules/graphics/opengl/Graphics.cpp

+ 4 - 4
src/modules/graphics/opengl/Graphics.cpp

@@ -294,6 +294,10 @@ bool Graphics::setMode(int width, int height)
 
 
 	setDebug(enabledebug);
 	setDebug(enabledebug);
 
 
+	// Reload all volatile objects.
+	if (!Volatile::loadAll())
+		::printf("Could not reload all volatile objects.\n");
+
 	// Create a quad indices object owned by love.graphics, so at least one
 	// Create a quad indices object owned by love.graphics, so at least one
 	// QuadIndices object is alive at all times while love.graphics is alive.
 	// QuadIndices object is alive at all times while love.graphics is alive.
 	// This makes sure there aren't too many expensive destruction/creations of
 	// This makes sure there aren't too many expensive destruction/creations of
@@ -302,10 +306,6 @@ bool Graphics::setMode(int width, int height)
 	if (quadIndices == nullptr)
 	if (quadIndices == nullptr)
 		quadIndices = new QuadIndices(20);
 		quadIndices = new QuadIndices(20);
 
 
-	// Reload all volatile objects.
-	if (!Volatile::loadAll())
-		::printf("Could not reload all volatile objects.\n");
-
 	// Restore the graphics state.
 	// Restore the graphics state.
 	restoreState(states.back());
 	restoreState(states.back());