From 5952ad368d35162241494655b0b50ebbcebc9539 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 28 Jan 2020 21:36:31 -0500 Subject: [PATCH] Fixed Haiku runtime errors. --- haiku/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/haiku/main.cpp b/haiku/main.cpp index 74c96ea9..ed5327bb 100644 --- a/haiku/main.cpp +++ b/haiku/main.cpp @@ -40,6 +40,7 @@ struct queueMainArgs { void *data; }; +// note: msg is owned by the BLooper base class and should not be freed by us void uiprivApplication::MessageReceived(BMessage *msg) { const void *data; @@ -55,7 +56,6 @@ void uiprivApplication::MessageReceived(BMessage *msg) uiprivInternalError("BMessage::FindData() failed in uiprivApplication::MessageReceived() for uiQueueMain(): %ld", status); args = (const struct queueMainArgs *) data; (*(args->f))(args->data); - delete msg; return; } BApplication::MessageReceived(msg); @@ -76,6 +76,8 @@ void uiprivSysQueueMain(void (*f)(void *data), void *data) // TODO decide if we should just give up in this case like we do with user errors uiprivInternalError("BMessage::AddData() failed in uiQueueMain(): %ld", status); status = uiprivApp->PostMessage(msg); + // msg is copied by PostMessage() so we can delete it here + delete msg; if (status != B_OK) uiprivInternalError("BApplication::PostMessage() failed in uiQueueMain(): %ld", status); }