mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into script-getmeshes-for-models
This commit is contained in:
commit
8a732e7d4b
6 changed files with 46 additions and 13 deletions
|
@ -91,9 +91,22 @@ void AssignmentClientMonitor::simultaneousWaitOnChildren(int waitMsecs) {
|
|||
}
|
||||
}
|
||||
|
||||
void AssignmentClientMonitor::childProcessFinished(qint64 pid) {
|
||||
void AssignmentClientMonitor::childProcessFinished(qint64 pid, int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
auto message = "Child process " + QString::number(pid) + " has %1 with exit code " + QString::number(exitCode) + ".";
|
||||
|
||||
if (_childProcesses.remove(pid)) {
|
||||
qDebug() << "Child process" << pid << "has finished. Removed from internal map.";
|
||||
message.append(" Removed from internal map.");
|
||||
} else {
|
||||
message.append(" Could not find process in internal map.");
|
||||
}
|
||||
|
||||
switch (exitStatus) {
|
||||
case QProcess::NormalExit:
|
||||
qDebug() << qPrintable(message.arg("returned"));
|
||||
break;
|
||||
case QProcess::CrashExit:
|
||||
qCritical() << qPrintable(message.arg("crashed"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +234,9 @@ void AssignmentClientMonitor::spawnChildClient() {
|
|||
auto pid = assignmentClient->processId();
|
||||
// make sure we hear that this process has finished when it does
|
||||
connect(assignmentClient, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
||||
this, [this, pid]() { childProcessFinished(pid); });
|
||||
this, [this, pid](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
childProcessFinished(pid, exitCode, exitStatus);
|
||||
});
|
||||
|
||||
qDebug() << "Spawned a child client with PID" << assignmentClient->processId();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
void stopChildProcesses();
|
||||
private slots:
|
||||
void checkSpares();
|
||||
void childProcessFinished(qint64 pid);
|
||||
void childProcessFinished(qint64 pid, int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void handleChildStatusPacket(QSharedPointer<ReceivedMessage> message);
|
||||
|
||||
bool handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool skipSubHandler = false) override;
|
||||
|
|
|
@ -47,6 +47,7 @@ extern "C" FILE * __cdecl __iob_func(void) {
|
|||
#include <QtCore/QDebug>
|
||||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTimer>
|
||||
#include <QProcess>
|
||||
#include <QSysInfo>
|
||||
#include <QThread>
|
||||
|
@ -1077,14 +1078,20 @@ void setMaxCores(uint8_t maxCores) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
VOID CALLBACK parentDiedCallback(PVOID lpParameter, BOOLEAN timerOrWaitFired) {
|
||||
if (!timerOrWaitFired && qApp) {
|
||||
void quitWithParentProcess() {
|
||||
if (qApp) {
|
||||
qDebug() << "Parent process died, quitting";
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
VOID CALLBACK parentDiedCallback(PVOID lpParameter, BOOLEAN timerOrWaitFired) {
|
||||
if (!timerOrWaitFired) {
|
||||
quitWithParentProcess();
|
||||
}
|
||||
}
|
||||
|
||||
void watchParentProcess(int parentPID) {
|
||||
DWORD processID = parentPID;
|
||||
HANDLE procHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID);
|
||||
|
@ -1092,8 +1099,17 @@ void watchParentProcess(int parentPID) {
|
|||
HANDLE newHandle;
|
||||
RegisterWaitForSingleObject(&newHandle, procHandle, parentDiedCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);
|
||||
}
|
||||
#else
|
||||
#elif defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||
void watchParentProcess(int parentPID) {
|
||||
qWarning() << "Parent PID option not implemented on this plateform";
|
||||
auto timer = new QTimer(qApp);
|
||||
timer->setInterval(MSECS_PER_SECOND);
|
||||
QObject::connect(timer, &QTimer::timeout, qApp, [parentPID]() {
|
||||
auto ppid = getppid();
|
||||
if (parentPID != ppid) {
|
||||
// If the PPID changed, then that means our parent process died.
|
||||
quitWithParentProcess();
|
||||
}
|
||||
});
|
||||
timer->start();
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
#endif
|
||||
|
|
|
@ -258,7 +258,8 @@ namespace cache {
|
|||
};
|
||||
}
|
||||
|
||||
void FileCache::eject(const FilePointer& file) {
|
||||
// Take file pointer by value to insure it doesn't get destructed during the "erase()" calls
|
||||
void FileCache::eject(FilePointer file) {
|
||||
file->_locked = false;
|
||||
const auto& length = file->getLength();
|
||||
const auto& key = file->getKey();
|
||||
|
|
|
@ -119,7 +119,7 @@ private:
|
|||
void clean();
|
||||
void clear();
|
||||
// Remove a file from the cache
|
||||
void eject(const FilePointer& file);
|
||||
void eject(FilePointer file);
|
||||
|
||||
size_t getOverbudgetAmount() const;
|
||||
|
||||
|
|
|
@ -229,7 +229,6 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
} else {
|
||||
removeButtonsFromToolbar();
|
||||
addButtonsToHomeScreen();
|
||||
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
||||
|
||||
// destroy desktop window
|
||||
if (_desktopWindow) {
|
||||
|
@ -237,6 +236,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
_desktopWindow = nullptr;
|
||||
}
|
||||
}
|
||||
loadHomeScreen(true);
|
||||
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
||||
}
|
||||
|
||||
static void addButtonProxyToQmlTablet(QQuickItem* qmlTablet, TabletButtonProxy* buttonProxy) {
|
||||
|
|
Loading…
Reference in a new issue