[haiku-3rdparty-dev] Target of BMessage from BMessageQueue?

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Sat, 13 Feb 2010 23:26:09 +0100

Hi all,

in the HaikuLauncher WebKit browser, I have code like this:

void WebProcess::skipToLastMessage(BMessage*& message)
{
    bool first = true;
    BMessageQueue* queue = Looper()->MessageQueue();
    while (BMessage* nextMessage = queue->FindMessage(message->what)) {
        if (!first)
            delete message;
        message = nextMessage;
        queue->RemoveMessage(message);
        first = false;
    }
}

This is suppose to fast-forward to the last message of a kind from within 
WebProcess::MessageReceived(). WebProcess is a BHandler attached to the 
BApplication. If there are more than one web pages open, there will be one 
WebProcess per page. And you can probably already see the problem. I am 
stealing messages from the other processes, and worst case, I end up 
processing a BMessage intended for another WebProcess. Is there any way to 
detect the intended BHandler target of a BMessage when peaking into the 
queue like that?

Best regards,
-Stephan

Other related posts: