summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqarmin <mikrutrafal54@gmail.com>2019-05-30 10:28:03 +0200
committerqarmin <mikrutrafal54@gmail.com>2019-05-30 10:28:03 +0200
commita32f020b53d36bed8de61d4313c572c72bcde3bb (patch)
treea1ba3ff513bb63761951a3d24c338b4cae6435d5
parent8c923fc61740afd560e6c814f7ef19b0cdc30112 (diff)
Properly unlock mutex
-rw-r--r--core/command_queue_mt.h4
-rw-r--r--core/io/file_access_network.cpp5
-rw-r--r--core/print_string.cpp2
3 files changed, 8 insertions, 3 deletions
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 59eabd8786..798fa4394d 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -406,8 +406,10 @@ class CommandQueueMT {
tryagain:
// tried to read an empty queue
- if (read_ptr == write_ptr)
+ if (read_ptr == write_ptr) {
+ if (p_lock) unlock();
return false;
+ }
uint32_t size_ptr = read_ptr;
uint32_t size = *(uint32_t *)&command_mem[read_ptr] >> 1;
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 722e62c54e..2572602e16 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -118,7 +118,10 @@ void FileAccessNetworkClient::_thread_func() {
FileAccessNetwork *fa = NULL;
if (response != FileAccessNetwork::RESPONSE_DATA) {
- ERR_FAIL_COND(!accesses.has(id));
+ if (!accesses.has(id)) {
+ unlock_mutex();
+ ERR_FAIL_COND(!accesses.has(id));
+ }
}
if (accesses.has(id))
diff --git a/core/print_string.cpp b/core/print_string.cpp
index d91d49f53b..3271744af3 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -68,8 +68,8 @@ void remove_print_handler(PrintHandlerList *p_handler) {
}
//OS::get_singleton()->print("print handler list is %p\n",print_handler_list);
- ERR_FAIL_COND(l == NULL);
_global_unlock();
+ ERR_FAIL_COND(l == NULL);
}
void print_line(String p_string) {