diff options
author | Anthony Pesch <anthony@usamp.com> | 2013-05-29 23:55:21 -0700 |
---|---|---|
committer | Anthony Pesch <anthony@usamp.com> | 2013-05-29 23:55:21 -0700 |
commit | 2c4df5bf6a6d149b881b1a124a0999623d806e82 (patch) | |
tree | cf30edef3abd52df0ef4e3b2a2baee6be2e56cd9 /src | |
parent | cc90517289784817d08cfd0035cdbe92957c75d3 (diff) |
Free old surface before creating new one
Diffstat (limited to 'src')
-rw-r--r-- | src/library_sdl.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index d31c37f5..4f871f9d 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -694,6 +694,11 @@ var LibrarySDL = { Module['canvas'].addEventListener(event, SDL.receiveEvent, true); }); Browser.setCanvasSize(width, height, true); + // Free the old surface first. + if (SDL.screen) { + SDL.freeSurface(SDL.screen); + SDL.screen = null; + } SDL.screen = SDL.makeSurface(width, height, flags, true, 'screen'); if (!SDL.addedResizeListener) { SDL.addedResizeListener = true; |