Skip to content

Commit 14897f6

Browse files
[Core] Prevent further infinite recursion when printing errors
1 parent da945ce commit 14897f6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/object/message_queue.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Error CallQueue::push_notification(ObjectID p_id, int p_notification) {
183183

184184
if ((page_bytes[pages_used - 1] + room_needed) > uint32_t(PAGE_SIZE_BYTES)) {
185185
if (pages_used == max_pages) {
186-
fprintf(stderr, "Failed notification: %s target ID: %s. Message queue out of memory. %s\n", itos(p_notification).utf8().get_data(), itos(p_id).utf8().get_data(), error_text.utf8().get_data());
186+
fprintf(stderr, "Failed notification: %d target ID: %s. Message queue out of memory. %s\n", p_notification, itos(p_id).utf8().get_data(), error_text.utf8().get_data());
187187
statistics();
188188
UNLOCK_MUTEX;
189189
return ERR_OUT_OF_MEMORY;
@@ -256,7 +256,7 @@ Error CallQueue::_transfer_messages_to_main_queue() {
256256
// Any other possibly existing source page needs to be added.
257257

258258
if (mq->pages_used + (pages_used - src_page) > mq->max_pages) {
259-
ERR_PRINT("Failed appending thread queue. Message queue out of memory. " + mq->error_text);
259+
fprintf(stderr, "Failed appending thread queue. Message queue out of memory. %s\n", mq->error_text.utf8().get_data());
260260
mq->statistics();
261261
mq->mutex.unlock();
262262
return ERR_OUT_OF_MEMORY;
@@ -462,8 +462,8 @@ void CallQueue::statistics() {
462462
} break;
463463
}
464464
if (null_target) {
465-
//object was deleted
466-
print_line("Object was deleted while awaiting a callback");
465+
// Object was deleted.
466+
fprintf(stdout, "Object was deleted while awaiting a callback.\n");
467467

468468
null_count++;
469469
}
@@ -481,19 +481,19 @@ void CallQueue::statistics() {
481481
}
482482
}
483483

484-
print_line("TOTAL PAGES: " + itos(pages_used) + " (" + itos(pages_used * PAGE_SIZE_BYTES) + " bytes).");
485-
print_line("NULL count: " + itos(null_count));
484+
fprintf(stdout, "TOTAL PAGES: %d (%d bytes).\n", pages_used, pages_used * PAGE_SIZE_BYTES);
485+
fprintf(stdout, "NULL count: %d.\n", null_count);
486486

487487
for (const KeyValue<StringName, int> &E : set_count) {
488-
print_line("SET " + E.key + ": " + itos(E.value));
488+
fprintf(stdout, "SET %s: %d.\n", String(E.key).utf8().get_data(), E.value);
489489
}
490490

491491
for (const KeyValue<Callable, int> &E : call_count) {
492-
print_line("CALL " + E.key + ": " + itos(E.value));
492+
fprintf(stdout, "CALL %s: %d.\n", String(E.key).utf8().get_data(), E.value);
493493
}
494494

495495
for (const KeyValue<int, int> &E : notify_count) {
496-
print_line("NOTIFY " + itos(E.key) + ": " + itos(E.value));
496+
fprintf(stdout, "NOTIFY %d: %d.\n", E.key, E.value);
497497
}
498498

499499
UNLOCK_MUTEX;

0 commit comments

Comments
 (0)