Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
4e732051
Commit
4e732051
authored
Jun 22, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(App): quit properly on SIGINT
parent
485a9f3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
App.hpp
src/app/App.hpp
+2
-3
SingleApplication.cpp
src/app/single-application/SingleApplication.cpp
+9
-5
SingleApplication.hpp
src/app/single-application/SingleApplication.hpp
+2
-0
SingleApplicationDBus.cpp
src/app/single-application/SingleApplicationDBus.cpp
+4
-0
No files found.
src/app/App.hpp
View file @
4e732051
...
@@ -72,6 +72,8 @@ public:
...
@@ -72,6 +72,8 @@ public:
bool
hasFocus
()
const
;
bool
hasFocus
()
const
;
void
quit
()
override
;
static
App
*
getInstance
()
{
static
App
*
getInstance
()
{
return
static_cast
<
App
*>
(
QApplication
::
instance
());
return
static_cast
<
App
*>
(
QApplication
::
instance
());
}
}
...
@@ -85,9 +87,6 @@ public:
...
@@ -85,9 +87,6 @@ public:
Q_INVOKABLE
static
void
smartShowWindow
(
QQuickWindow
*
window
);
Q_INVOKABLE
static
void
smartShowWindow
(
QQuickWindow
*
window
);
public
slots
:
void
quit
();
signals:
signals:
void
configLocaleChanged
(
const
QString
&
locale
);
void
configLocaleChanged
(
const
QString
&
locale
);
...
...
src/app/single-application/SingleApplication.cpp
View file @
4e732051
...
@@ -251,16 +251,16 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
...
@@ -251,16 +251,16 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
}
}
void
SingleApplicationPrivate
::
terminate
(
int
signum
)
{
void
SingleApplicationPrivate
::
terminate
(
int
signum
)
{
if
(
signum
==
SIGINT
)
{
SingleApplication
::
instance
()
->
quit
();
return
;
}
while
(
!
sharedMem
.
empty
())
{
while
(
!
sharedMem
.
empty
())
{
delete
sharedMem
.
back
();
delete
sharedMem
.
back
();
sharedMem
.
pop_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
);
::
exit
(
128
+
signum
);
}
}
...
@@ -453,3 +453,7 @@ bool SingleApplication::sendMessage (QByteArray message, int timeout) {
...
@@ -453,3 +453,7 @@ bool SingleApplication::sendMessage (QByteArray message, int timeout) {
d
->
socket
->
waitForBytesWritten
(
timeout
);
d
->
socket
->
waitForBytesWritten
(
timeout
);
return
dataWritten
;
return
dataWritten
;
}
}
void
SingleApplication
::
quit
()
{
QCoreApplication
::
quit
();
}
src/app/single-application/SingleApplication.hpp
View file @
4e732051
...
@@ -112,6 +112,8 @@ public:
...
@@ -112,6 +112,8 @@ public:
*/
*/
bool
sendMessage
(
QByteArray
message
,
int
timeout
=
100
);
bool
sendMessage
(
QByteArray
message
,
int
timeout
=
100
);
virtual
void
quit
();
Q_SIGNALS:
Q_SIGNALS:
void
instanceStarted
();
void
instanceStarted
();
void
receivedMessage
(
quint32
instanceId
,
QByteArray
message
);
void
receivedMessage
(
quint32
instanceId
,
QByteArray
message
);
...
...
src/app/single-application/SingleApplicationDBus.cpp
View file @
4e732051
...
@@ -119,3 +119,7 @@ void SingleApplicationPrivate::messageReceived (quint32 instanceId, QByteArray m
...
@@ -119,3 +119,7 @@ void SingleApplicationPrivate::messageReceived (quint32 instanceId, QByteArray m
Q_Q
(
SingleApplication
);
Q_Q
(
SingleApplication
);
Q_EMIT
q
->
receivedMessage
(
instanceId
,
message
);
Q_EMIT
q
->
receivedMessage
(
instanceId
,
message
);
}
}
void
SingleApplication
::
quit
()
{
QCoreApplication
::
quit
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment