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;