diff options
author | Marc Gilleron <marc.gilleron@gmail.com> | 2022-10-15 13:06:00 +0100 |
---|---|---|
committer | Marc Gilleron <marc.gilleron@gmail.com> | 2022-10-15 13:06:00 +0100 |
commit | 9efb2e786e266cdba9be87d3ca473c5e178ca1ae (patch) | |
tree | b7da5b8a34dcc8bb9f85f2002cb31d2b924c0505 /editor/plugins/tiles/tiles_editor_plugin.cpp | |
parent | dc4b6165962536b53c4c1471fcf0be43c70e2335 (diff) |
Fix case where mutex is never unlocked
Diffstat (limited to 'editor/plugins/tiles/tiles_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/tiles/tiles_editor_plugin.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 364c3b7246..6fdc9a80e8 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -66,7 +66,9 @@ void TilesEditorPlugin::_thread() { pattern_preview_sem.wait(); pattern_preview_mutex.lock(); - if (pattern_preview_queue.size()) { + if (pattern_preview_queue.size() == 0) { + pattern_preview_mutex.unlock(); + } else { QueueItem item = pattern_preview_queue.front()->get(); pattern_preview_queue.pop_front(); pattern_preview_mutex.unlock(); @@ -130,8 +132,6 @@ void TilesEditorPlugin::_thread() { item.callback.callp(args_ptr, 2, r, error); viewport->queue_delete(); - } else { - pattern_preview_mutex.unlock(); } } } |