summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAndreaCatania <info@andreacatania.com>2021-08-17 12:44:07 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-02-11 22:45:14 +0100
commit02f21076209dfa51c74022f3a4bd82017876373b (patch)
treed72227ee7545227a71fdcf30a5f0781e028792f0 /core
parenta4c2d8dc7a7f74bd3769dc0616d726f7a02968e2 (diff)
Improve error reporting when the Message Queue is out of Memory.
The function `statistics()`, called when the MessageQueue is out of memory, will still use the MessageQueue so it crashes. Moving the error above will improve the behavior since the developer will find the crash reasons and the instruction on how to fix it.
Diffstat (limited to 'core')
-rw-r--r--core/object/message_queue.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp
index ebed6c21e9..decf030e27 100644
--- a/core/object/message_queue.cpp
+++ b/core/object/message_queue.cpp
@@ -55,9 +55,9 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari
if (ObjectDB::get_instance(p_id)) {
type = ObjectDB::get_instance(p_id)->get_class();
}
- print_line("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id));
+ ERR_PRINT("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id) + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
statistics();
- ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
+ return ERR_OUT_OF_MEMORY;
}
Message *msg = memnew_placement(&buffer[buffer_end], Message);
@@ -82,9 +82,9 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
uint8_t room_needed = sizeof(Message);
if ((buffer_end + room_needed) >= buffer_size) {
- print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id));
+ ERR_PRINT("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id) + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
statistics();
- ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
+ return ERR_OUT_OF_MEMORY;
}
Message *msg = memnew_placement(&buffer[buffer_end], Message);
@@ -117,9 +117,9 @@ Error MessageQueue::push_callablep(const Callable &p_callable, const Variant **p
int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount;
if ((buffer_end + room_needed) >= buffer_size) {
- print_line("Failed method: " + p_callable);
+ ERR_PRINT("Failed method: " + p_callable + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
statistics();
- ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.");
+ return ERR_OUT_OF_MEMORY;
}
Message *msg = memnew_placement(&buffer[buffer_end], Message);