Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit d5e9cd6

Browse files
committed
Merge branch 'bugfix-10991' into release-6.1.0
2 parents 6bd6115 + 6672b4b commit d5e9cd6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/notes/bugfix-10991.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# If a memory warning is received whilst acceleratedRendering mode is enabled, a crash can occur on iOS.

engine/src/tilecachegl.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
2929
#include "packed.h"
3030
#include "mbldc.h"
3131

32+
#include <pthread.h>
33+
3234
#if defined(_IOS_MOBILE)
3335
#include <CoreGraphics/CoreGraphics.h>
3436
#import <OpenGLES/ES1/gl.h>
@@ -187,6 +189,7 @@ static bool MCTileCacheOpenGLCompositorCreateTile(MCTileCacheOpenGLCompositorCon
187189
super_tile *t_super_tile;
188190
if (!MCMemoryAllocate(8 + self -> super_tile_arity, t_super_tile))
189191
return false;
192+
190193

191194
// Generate a texture id, and bind an empty texture.
192195
glGenTextures(1, &t_super_tile -> texture);
@@ -214,7 +217,7 @@ static bool MCTileCacheOpenGLCompositorCreateTile(MCTileCacheOpenGLCompositorCon
214217

215218
// Make sure we don't make redundent bind calls.
216219
self -> current_texture = t_super_tile -> texture;
217-
220+
218221
// And compute the id (note the subtile index is 0!).
219222
MCTileCacheOpenGLCompositorEncodeTile(self, t_super_tile_index, 0, r_tile);
220223

@@ -254,6 +257,7 @@ static void MCTileCacheOpenGLCompositorFlushSuperTiles(MCTileCacheOpenGLComposit
254257
glDeleteTextures(1, &self -> super_tiles[i] -> texture);
255258
MCMemoryDelete(self -> super_tiles[i]);
256259
self -> super_tiles[i] = nil;
260+
257261
}
258262
}
259263
}
@@ -278,7 +282,9 @@ bool MCTileCacheOpenGLCompositor_BeginTiling(void *p_context)
278282
if (t_super_tile_arity != self -> super_tile_arity ||
279283
self -> needs_flush)
280284
{
281-
MCTileCacheOpenGLCompositorFlushSuperTiles(self, true);
285+
// MW-2013-06-26: [[ Bug 10991 ]] Don't force flushing of the tilecache, otherwise
286+
// we end up discarding tiles that are still needed after a 'compact()' operation.
287+
MCTileCacheOpenGLCompositorFlushSuperTiles(self, false);
282288

283289
self -> super_tile_arity = t_super_tile_arity;
284290
self -> needs_flush = false;

0 commit comments

Comments
 (0)