1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| | From 9cf08623e3092fa19366e5c07fbe06898a59f039 Mon Sep 17 00:00:00 2001
From: Ronan Abhamon <ronan.abhamon@belledonne-communications.com>
Date: Fri, 26 Jan 2018 11:45:53 +0100
Subject: [PATCH] feat(SingleApplication): don't touch sockets when SIGABRT,
SIGBUS or SIGSEGV is handled
---
src/app/single-application/SingleApplication.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/app/single-application/SingleApplication.cpp b/src/app/single-application/SingleApplication.cpp
index d64903ba..b42285b5 100644
--- a/src/app/single-application/SingleApplication.cpp
+++ b/src/app/single-application/SingleApplication.cpp
@@ -256,11 +256,21 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
return;
}
+ // Dangerous signals. Exit directly after shared memory destruction.
+ // Don't touch sockets => avoid dead locks.
+ for (int crashSig : { SIGABRT, SIGBUS, SIGSEGV })
+ if (signum == crashSig) {
+ for (SingleApplicationPrivate *d : sharedMem)
+ delete d->memory;
+ goto forceExit;
+ }
+
while (!sharedMem.empty()) {
delete sharedMem.back();
sharedMem.pop_back();
}
+ forceExit:
::exit(128 + signum);
}
--
2.21.0
|