Commit 9cf08623 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(SingleApplication): don't touch sockets when SIGABRT, SIGBUS or SIGSEGV is handled

parent c8509589
...@@ -256,11 +256,21 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType) ...@@ -256,11 +256,21 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
return; 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()) { while (!sharedMem.empty()) {
delete sharedMem.back(); delete sharedMem.back();
sharedMem.pop_back(); sharedMem.pop_back();
} }
forceExit:
::exit(128 + signum); ::exit(128 + signum);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment