From c9f9a6b20d3973397a4101bd1ffc22c5d2a5bdb7 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 12 Jan 2005 03:20:15 +0000 Subject: [PATCH] * fReplyTo.target (the handler token) is internally checked even, if the preferred handler is addressed. So make sure, it has a usable value in this case, otherwise ReturnAddress() usually won't work. * If the message to be read from the port is bigger than the on-stack buffer, the chunk of memory to be allocated on the heap has to be the size of the message, not the size of the on-stack buffer. This caused all kind of nasty, hard-trackable problems. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10677 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Message.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index c8802f8a77..f6c6d07289 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -1790,7 +1790,8 @@ status_t BMessage::_send_(port_id port, int32 token, bool preferred, self->fReplyRequired = reply_required; self->fReplyTo.team = reply_to.fTeam; self->fReplyTo.port = reply_to.fPort; - self->fReplyTo.target = reply_to.fHandlerToken; + self->fReplyTo.target = (reply_to.fPreferredTarget + ? B_PREFERRED_TOKEN : reply_to.fHandlerToken); self->fReplyTo.preferred = reply_to.fPreferredTarget; char tmp[0x800]; @@ -1928,7 +1929,7 @@ static status_t handle_reply(port_id reply_port, } else { - pAllocd = new char[0x800]; + pAllocd = new char[err]; pMem = pAllocd; } do