Merge pull request #76747 from RandomShaper/fix_mq_redundant
Mend some checks in CallQueue
This commit is contained in:
commit
0daa634f24
1 changed files with 3 additions and 2 deletions
|
@ -62,15 +62,16 @@ Error CallQueue::push_set(Object *p_object, const StringName &p_prop, const Vari
|
|||
}
|
||||
|
||||
Error CallQueue::push_callablep(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) {
|
||||
mutex.lock();
|
||||
uint32_t room_needed = sizeof(Message) + sizeof(Variant) * p_argcount;
|
||||
|
||||
ERR_FAIL_COND_V_MSG(room_needed > uint32_t(PAGE_SIZE_BYTES), ERR_INVALID_PARAMETER, "Message is too large to fit on a page (" + itos(PAGE_SIZE_BYTES) + " bytes), consider passing less arguments.");
|
||||
|
||||
mutex.lock();
|
||||
|
||||
_ensure_first_page();
|
||||
|
||||
if ((page_offset + room_needed) > uint32_t(PAGE_SIZE_BYTES)) {
|
||||
if (room_needed > uint32_t(PAGE_SIZE_BYTES) || pages_used == max_pages) {
|
||||
if (pages_used == max_pages) {
|
||||
ERR_PRINT("Failed method: " + p_callable + ". Message queue out of memory. " + error_text);
|
||||
statistics();
|
||||
mutex.unlock();
|
||||
|
|
Loading…
Reference in a new issue