mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-28 20:06:20 +00:00
feat(App): quit properly on SIGINT
This commit is contained in:
parent
485a9f3e75
commit
4e7320519a
4 changed files with 17 additions and 8 deletions
|
|
@ -72,6 +72,8 @@ public:
|
|||
|
||||
bool hasFocus () const;
|
||||
|
||||
void quit () override;
|
||||
|
||||
static App *getInstance () {
|
||||
return static_cast<App *>(QApplication::instance());
|
||||
}
|
||||
|
|
@ -85,9 +87,6 @@ public:
|
|||
|
||||
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
|
||||
|
||||
public slots:
|
||||
void quit ();
|
||||
|
||||
signals:
|
||||
void configLocaleChanged (const QString &locale);
|
||||
|
||||
|
|
|
|||
|
|
@ -251,16 +251,16 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
|
|||
}
|
||||
|
||||
void SingleApplicationPrivate::terminate (int signum) {
|
||||
if (signum == SIGINT) {
|
||||
SingleApplication::instance()->quit();
|
||||
return;
|
||||
}
|
||||
|
||||
while (!sharedMem.empty()) {
|
||||
delete sharedMem.back();
|
||||
sharedMem.pop_back();
|
||||
}
|
||||
|
||||
cout << "[PROCESS ABNORMALLY TERMINATED]: " << signum << endl;
|
||||
#ifdef Q_OS_LINUX
|
||||
cout << "If you have used valgrind, please remove your ~/.ICEauthority file and rerun." << endl;
|
||||
#endif // ifdef Q_OS_UNIX
|
||||
|
||||
::exit(128 + signum);
|
||||
}
|
||||
|
||||
|
|
@ -453,3 +453,7 @@ bool SingleApplication::sendMessage (QByteArray message, int timeout) {
|
|||
d->socket->waitForBytesWritten(timeout);
|
||||
return dataWritten;
|
||||
}
|
||||
|
||||
void SingleApplication::quit () {
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ public:
|
|||
*/
|
||||
bool sendMessage (QByteArray message, int timeout = 100);
|
||||
|
||||
virtual void quit ();
|
||||
|
||||
Q_SIGNALS:
|
||||
void instanceStarted ();
|
||||
void receivedMessage (quint32 instanceId, QByteArray message);
|
||||
|
|
|
|||
|
|
@ -119,3 +119,7 @@ void SingleApplicationPrivate::messageReceived (quint32 instanceId, QByteArray m
|
|||
Q_Q(SingleApplication);
|
||||
Q_EMIT q->receivedMessage(instanceId, message);
|
||||
}
|
||||
|
||||
void SingleApplication::quit () {
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue