stippi + bonefish:
Fixed race conditions when a ServerApp or ServerWindow is created. The reply to the client that the object has been created successfully was sent in the thread creating it. Preempted at the wrong time (right after writing the message to the port) could lead to the object's thread using the link at the same time, which would screw up all subsequent communication via that link. This fixes the problem that mimeset would sometimes fail when building Haiku in Haiku (can't find the ticket). It probably also fixes #2331, and the bug that sometimes when a window is opened (Terminal, crash alert, shutdown window, etc.) it would come up with huge width/height and tiny other dimension (can't find the ticket). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26192 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0c48c43777
commit
f592fcef43
@ -205,26 +205,6 @@ ServerApp::InitCheck()
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Starts the ServerApp monitoring for messages
|
||||
\return false if the application couldn't start, true if everything went OK.
|
||||
*/
|
||||
bool
|
||||
ServerApp::Run()
|
||||
{
|
||||
if (!MessageLooper::Run())
|
||||
return false;
|
||||
|
||||
// Let's tell the client how to talk with us
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<port_id>(fMessagePort);
|
||||
fLink.Attach<area_id>(fDesktop->SharedReadOnlyArea());
|
||||
fLink.Flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief This quits the application and deletes it. You're not supposed
|
||||
to call its destructor directly.
|
||||
@ -340,6 +320,12 @@ ServerApp::_MessageLooper()
|
||||
{
|
||||
// Message-dispatching loop for the ServerApp
|
||||
|
||||
// First let's tell the client how to talk with us.
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<port_id>(fMessagePort);
|
||||
fLink.Attach<area_id>(fDesktop->SharedReadOnlyArea());
|
||||
fLink.Flush();
|
||||
|
||||
BPrivate::LinkReceiver &receiver = fLink.Receiver();
|
||||
|
||||
int32 code;
|
||||
|
@ -50,7 +50,6 @@ class ServerApp : public MessageLooper {
|
||||
status_t InitCheck();
|
||||
void Quit(sem_id shutdownSemaphore = -1);
|
||||
|
||||
virtual bool Run();
|
||||
virtual port_id MessagePort() const { return fMessagePort; }
|
||||
|
||||
/*!
|
||||
|
@ -297,32 +297,6 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ServerWindow::Run()
|
||||
{
|
||||
if (!MessageLooper::Run())
|
||||
return false;
|
||||
|
||||
// Send a reply to our window - it is expecting fMessagePort
|
||||
// port and some other info
|
||||
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<port_id>(fMessagePort);
|
||||
|
||||
int32 minWidth, maxWidth, minHeight, maxHeight;
|
||||
fWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||
|
||||
fLink.Attach<BRect>(fWindow->Frame());
|
||||
fLink.Attach<float>((float)minWidth);
|
||||
fLink.Attach<float>((float)maxWidth);
|
||||
fLink.Attach<float>((float)minHeight);
|
||||
fLink.Attach<float>((float)maxHeight);
|
||||
fLink.Flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ServerWindow::_PrepareQuit()
|
||||
{
|
||||
@ -2844,6 +2818,22 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
void
|
||||
ServerWindow::_MessageLooper()
|
||||
{
|
||||
// Send a reply to our window - it is expecting fMessagePort
|
||||
// port and some other info.
|
||||
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<port_id>(fMessagePort);
|
||||
|
||||
int32 minWidth, maxWidth, minHeight, maxHeight;
|
||||
fWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||
|
||||
fLink.Attach<BRect>(fWindow->Frame());
|
||||
fLink.Attach<float>((float)minWidth);
|
||||
fLink.Attach<float>((float)maxWidth);
|
||||
fLink.Attach<float>((float)minHeight);
|
||||
fLink.Attach<float>((float)maxHeight);
|
||||
fLink.Flush();
|
||||
|
||||
BPrivate::LinkReceiver& receiver = fLink.Receiver();
|
||||
bool quitLoop = false;
|
||||
|
||||
|
@ -57,7 +57,6 @@ public:
|
||||
status_t Init(BRect frame, window_look look,
|
||||
window_feel feel, uint32 flags,
|
||||
uint32 workspace);
|
||||
virtual bool Run();
|
||||
virtual port_id MessagePort() const { return fMessagePort; }
|
||||
|
||||
::EventTarget& EventTarget() { return fEventTarget; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user