From bcab07add0512a547028cb0a6a11b0085f1ee4ec Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 15 Jan 2005 00:28:58 +0000 Subject: [PATCH] * More sophisticated debug output macro. * Fixed BLooper::ReadMessageFromPort(). If ReadRawFromPort() failed, there was nevertheless a message created and dispatched. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10738 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Looper.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 123c8e6a38..1dc0e5fad7 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -40,6 +40,17 @@ #define DBG(x) ; #define PRINT(x) DBG({ printf("[%6ld] ", find_thread(NULL)); printf x; }) +/* +#include +#include +static BLocker sDebugPrintLocker("BLooper debug print"); +#define PRINT(x) DBG({ \ + BAutolock _(sDebugPrintLocker); \ + debug_printf("[%6ld] ", find_thread(NULL)); \ + debug_printf x; \ +}) +*/ + // Standard Includes ----------------------------------------------------------- #include @@ -1247,13 +1258,12 @@ PRINT(("BLooper::ReadMessageFromPort()\n")); BMessage* bmsg; void* msgbuffer = ReadRawFromPort(&msgcode, tout); + if (!msgbuffer) + return NULL; bmsg = ConvertToMessage(msgbuffer, msgcode); - if (msgbuffer) - { - delete[] (int8*)msgbuffer; - } + delete[] (int8*)msgbuffer; PRINT(("BLooper::ReadMessageFromPort() done: %p\n", bmsg)); return bmsg;