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;
|
BList* fCommonFilters;
|
||||||
bool fTerminating;
|
bool fTerminating;
|
||||||
bool fRunCalled;
|
bool fRunCalled;
|
||||||
|
bool fOwnsPort;
|
||||||
uint32 _reserved[11];
|
uint32 _reserved[11];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -267,6 +267,8 @@ BApplication::BApplication(const char* signature, const char* looperName,
|
|||||||
looperName != NULL ? looperName : kDefaultLooperName)
|
looperName != NULL ? looperName : kDefaultLooperName)
|
||||||
{
|
{
|
||||||
_InitData(signature, initGUI, _error);
|
_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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -130,7 +130,7 @@ BLooper::~BLooper()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the message port and read and reply to the remaining messages.
|
// Close the message port and read and reply to the remaining messages.
|
||||||
if (fMsgPort >= 0)
|
if (fMsgPort >= 0 && fOwnsPort)
|
||||||
close_port(fMsgPort);
|
close_port(fMsgPort);
|
||||||
|
|
||||||
// Clear the queue so our call to IsMessageWaiting() below doesn't give
|
// Clear the queue so our call to IsMessageWaiting() below doesn't give
|
||||||
@@ -143,13 +143,15 @@ BLooper::~BLooper()
|
|||||||
// msg will automagically post generic reply
|
// msg will automagically post generic reply
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
if (!fOwnsPort) {
|
||||||
delete ReadMessageFromPort(0);
|
do {
|
||||||
// msg will automagically post generic reply
|
delete ReadMessageFromPort(0);
|
||||||
} while (IsMessageWaiting());
|
// msg will automagically post generic reply
|
||||||
|
} while (IsMessageWaiting());
|
||||||
|
|
||||||
|
delete_port(fMsgPort);
|
||||||
|
}
|
||||||
fDirectTarget->Release();
|
fDirectTarget->Release();
|
||||||
delete_port(fMsgPort);
|
|
||||||
|
|
||||||
// Clean up our filters
|
// Clean up our filters
|
||||||
SetCommonFilterList(NULL);
|
SetCommonFilterList(NULL);
|
||||||
@@ -945,6 +947,7 @@ BLooper::_InitData(const char* name, int32 priority, port_id port,
|
|||||||
fPreferred = NULL;
|
fPreferred = NULL;
|
||||||
fThread = B_ERROR;
|
fThread = B_ERROR;
|
||||||
fTerminating = false;
|
fTerminating = false;
|
||||||
|
fOwnsPort = true;
|
||||||
fMsgPort = -1;
|
fMsgPort = -1;
|
||||||
fAtomicCount = 0;
|
fAtomicCount = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user