Fix DialogBrowse crashing when deleting the last item nullptr. In iOS use std::recursive_mutex instead of the custom check.

This commit is contained in:
2018-10-03 01:02:53 +02:00
parent c9aecf885d
commit f45eefe433
3 changed files with 65 additions and 22 deletions

View File

@@ -39,23 +39,26 @@ int t_count = 0;
glm::vec2 t_pos;
int lock_count = 0;
NSThread* lock_thread;
std::recursive_mutex lock_mutex;
@implementation GameViewController
- (void)async_lock
{
if (lock_thread != [NSThread currentThread] || lock_count == 0)
[gl_lock lock];
lock_thread = [NSThread currentThread];
lock_count++;
lock_mutex.lock();
// if (lock_thread != [NSThread currentThread] || lock_count == 0)
// [gl_lock lock];
// lock_thread = [NSThread currentThread];
// lock_count++;
[EAGLContext setCurrentContext:self.context];
GLKView* view = (GLKView*)self.view;
[view bindDrawable];
}
- (void)async_unlock
{
lock_count--;
if (lock_count == 0)
[gl_lock unlock];
// lock_count--;
// if (lock_count == 0)
// [gl_lock unlock];
lock_mutex.unlock();
}
- (void)async_swap
{