BLooper: don't delete a launch_daemon port.
* Unless the service is really to be quit, the port should stay around; but that decision is to be made by the launch_daemon, not the service itself.
This commit is contained in:
@@ -172,6 +172,7 @@ private:
|
||||
BList* fCommonFilters;
|
||||
bool fTerminating;
|
||||
bool fRunCalled;
|
||||
bool fOwnsPort;
|
||||
uint32 _reserved[11];
|
||||
};
|
||||
|
||||
|
||||
@@ -267,6 +267,8 @@ BApplication::BApplication(const char* signature, const char* looperName,
|
||||
looperName != NULL ? looperName : kDefaultLooperName)
|
||||
{
|
||||
_InitData(signature, initGUI, _error);
|
||||
if (port < 0)
|
||||
fOwnsPort = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2013 Haiku, Inc. All rights reserved
|
||||
* Copyright 2001-2015 Haiku, Inc. All rights reserved
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -130,7 +130,7 @@ BLooper::~BLooper()
|
||||
}
|
||||
|
||||
// Close the message port and read and reply to the remaining messages.
|
||||
if (fMsgPort >= 0)
|
||||
if (fMsgPort >= 0 && fOwnsPort)
|
||||
close_port(fMsgPort);
|
||||
|
||||
// Clear the queue so our call to IsMessageWaiting() below doesn't give
|
||||
@@ -143,13 +143,15 @@ BLooper::~BLooper()
|
||||
// msg will automagically post generic reply
|
||||
}
|
||||
|
||||
do {
|
||||
delete ReadMessageFromPort(0);
|
||||
// msg will automagically post generic reply
|
||||
} while (IsMessageWaiting());
|
||||
if (!fOwnsPort) {
|
||||
do {
|
||||
delete ReadMessageFromPort(0);
|
||||
// msg will automagically post generic reply
|
||||
} while (IsMessageWaiting());
|
||||
|
||||
delete_port(fMsgPort);
|
||||
}
|
||||
fDirectTarget->Release();
|
||||
delete_port(fMsgPort);
|
||||
|
||||
// Clean up our filters
|
||||
SetCommonFilterList(NULL);
|
||||
@@ -945,6 +947,7 @@ BLooper::_InitData(const char* name, int32 priority, port_id port,
|
||||
fPreferred = NULL;
|
||||
fThread = B_ERROR;
|
||||
fTerminating = false;
|
||||
fOwnsPort = true;
|
||||
fMsgPort = -1;
|
||||
fAtomicCount = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user