浏览代码

gobj: TexturePool.release_all_textures() also clears preloadedImages

rdb 4 年之前
父节点
当前提交
4237d98067
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      panda/src/gobj/texturePool.cxx

+ 13 - 0
panda/src/gobj/texturePool.cxx

@@ -30,6 +30,10 @@
 
 
 #include <algorithm>
 #include <algorithm>
 
 
+#ifdef __EMSCRIPTEN__
+#include <emscripten.h>
+#endif
+
 using std::istream;
 using std::istream;
 using std::ostream;
 using std::ostream;
 using std::string;
 using std::string;
@@ -973,6 +977,15 @@ ns_release_all_textures() {
 
 
   // Blow away the cache of resolved relative filenames.
   // Blow away the cache of resolved relative filenames.
   _relpath_lookup.clear();
   _relpath_lookup.clear();
+
+#ifdef __EMSCRIPTEN__
+  // Also empty the emscripten preload cache.
+  EM_ASM({
+    if (Module["preloadedImages"]) {
+      Module["preloadedImages"] = {};
+    }
+  });
+#endif
 }
 }
 
 
 /**
 /**