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

Commit 7383aa4

Browse files
[[ ThreadedRendering ]] Fixed issues with image locking.
1 parent 540a0b6 commit 7383aa4

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

engine/src/image_rep.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,16 @@ bool MCLoadableImageRep::LockImageFrame(uindex_t p_frame, MCGFloat p_density, MC
239239
if (m_frame_count != 0 && p_frame >= m_frame_count)
240240
return false;
241241

242+
MCThreadMutexLock(m_frame_lock);
243+
244+
if (m_frame_count != 0 && p_frame >= m_frame_count)
245+
return false;
246+
242247
if (!EnsureMCGImageFrames())
243248
return false;
244249

245250
if (p_frame >= m_frame_count)
246251
return false;
247-
248-
MCThreadMutexLock(m_frame_lock);
249252

250253
// prevent data being removed by cache flush
251254
m_lock_count++;

engine/src/stacktile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ void MCStackTileCollectAll(void)
132132
t_tile -> tile -> Unlock();
133133
t_tile -> tile = NULL;
134134
MCLog("TILE %d COLLECTED", t_tile -> index);
135-
136135

137136
// Move the tile to the inactive list.
138137
t_tile -> next = s_inactive_tiles;

libgraphics/src/image.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ static void MCGImageDestroy(MCGImageRef self)
2424
if (self != NULL)
2525
{
2626
if (self -> bitmap != NULL)
27+
{
28+
self -> bitmap -> unlockPixels();
2729
delete self -> bitmap;
30+
}
2831
MCMemoryDelete(self);
2932
}
3033
}
@@ -44,6 +47,7 @@ bool MCGImageCreateWithSkBitmap(const SkBitmap &p_bitmap, MCGImageRef &r_image)
4447
if (t_success)
4548
{
4649
t_bitmap = new SkBitmap(p_bitmap);
50+
t_bitmap -> lockPixels();
4751
t_success = nil != t_bitmap;
4852
}
4953

0 commit comments

Comments
 (0)