aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--README.md36
-rw-r--r--singleapplication_p.cpp43
-rw-r--r--singleapplication_p.h5
4 files changed, 12 insertions, 77 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 63f1908..8ae3a03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog
=========
+__3.0.12a__
+----------
+
+* Removed signal handling.
+
__3.0.11a__
----------
diff --git a/README.md b/README.md
index 82e7a5b..0b1a355 100644
--- a/README.md
+++ b/README.md
@@ -252,36 +252,14 @@ Implementation
The library is implemented with a QSharedMemory block which is thread safe and
guarantees a race condition will not occur. It also uses a QLocalSocket to
notify the main process that a new instance had been spawned and thus invoke the
-`instanceStarted()` signal.
-
-To handle an issue on `*nix` systems, where the operating system owns the shared
-memory block and if the program crashes the memory remains untouched, the
-library binds to the following signals and closes the program with
-`error code = 128 + signum` where signum is the number representation of the
-signal listed below. Handling the signal is required in order to safely delete
-the `QSharedMemory` block. Each of these signals are potentially lethal and will
-results in process termination.
-
-* `SIGHUP` - `1`, Hangup.
-* `SIGINT` - `2`, Terminal interrupt signal
-* `SIGQUIT` - `3`, Terminal quit signal.
-* `SIGILL` - `4`, Illegal instruction.
-* `SIGABRT` - `6`, Process abort signal.
-* `SIGBUS` - `7`, Access to an undefined portion of a memory object.
-* `SIGFPE` - `8`, Erroneous arithmetic operation (such as division by zero).
-* `SIGSEGV` - `11`, Invalid memory reference.
-* `SIGSYS` - `12`, Bad system call.
-* `SIGPIPE` - `13`, Write on a pipe with no one to read it.
-* `SIGALRM` - `14`, Alarm clock.
-* `SIGTERM` - `15`, Termination signal.
-* `SIGXCPU` - `24`, CPU time limit exceeded.
-* `SIGXFSZ` - `25`, File size limit exceeded.
-
-Additionally the library can recover from being killed with uncatchable signals
-and will reset the memory block given that there are no other instances running.
+`instanceStarted()` signal and for messaging the primary instance.
+
+Additionally the library can recover from being forcefully killed on *nix
+systems and will reset the memory block given that there are no other
+instances running.
License
-------
This library and it's supporting documentation are released under
-`The MIT License (MIT)` with the exception of some of the examples distributed
-under the BSD license.
+`The MIT License (MIT)` with the exception of the Qt calculator examples which
+is distributed under the BSD license.
diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp
index 5bbaf8b..7e58d2b 100644
--- a/singleapplication_p.cpp
+++ b/singleapplication_p.cpp
@@ -45,11 +45,6 @@
#include "singleapplication.h"
#include "singleapplication_p.h"
-#ifdef Q_OS_UNIX
- #include <signal.h>
- #include <unistd.h>
-#endif
-
#ifdef Q_OS_WIN
#include <windows.h>
#include <lmcons.h>
@@ -150,11 +145,6 @@ void SingleApplicationPrivate::startPrimary()
{
Q_Q(SingleApplication);
-#ifdef Q_OS_UNIX
- // Handle any further termination signals to ensure the
- // QSharedMemory block is deleted even if the process crashes
- crashHandler();
-#endif
// Successful creation means that no main process exists
// So we start a QLocalServer to listen for connections
QLocalServer::removeServer( blockServerName );
@@ -188,11 +178,6 @@ void SingleApplicationPrivate::startPrimary()
void SingleApplicationPrivate::startSecondary()
{
-#ifdef Q_OS_UNIX
- // Handle any further termination signals to ensure the
- // QSharedMemory block is deleted even if the process crashes
- crashHandler();
-#endif
}
void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )
@@ -263,34 +248,6 @@ qint64 SingleApplicationPrivate::primaryPid()
return pid;
}
-#ifdef Q_OS_UNIX
- void SingleApplicationPrivate::crashHandler()
- {
- // Handle any further termination signals to ensure the
- // QSharedMemory block is deleted even if the process crashes
- signal( SIGHUP, SingleApplicationPrivate::terminate ); // 1
- signal( SIGINT, SingleApplicationPrivate::terminate ); // 2
- signal( SIGQUIT, SingleApplicationPrivate::terminate ); // 3
- signal( SIGILL, SingleApplicationPrivate::terminate ); // 4
- signal( SIGABRT, SingleApplicationPrivate::terminate ); // 6
- signal( SIGFPE, SingleApplicationPrivate::terminate ); // 8
- signal( SIGBUS, SingleApplicationPrivate::terminate ); // 10
- signal( SIGSEGV, SingleApplicationPrivate::terminate ); // 11
- signal( SIGSYS, SingleApplicationPrivate::terminate ); // 12
- signal( SIGPIPE, SingleApplicationPrivate::terminate ); // 13
- signal( SIGALRM, SingleApplicationPrivate::terminate ); // 14
- signal( SIGTERM, SingleApplicationPrivate::terminate ); // 15
- signal( SIGXCPU, SingleApplicationPrivate::terminate ); // 24
- signal( SIGXFSZ, SingleApplicationPrivate::terminate ); // 25
- }
-
- [[noreturn]] void SingleApplicationPrivate::terminate( int signum )
- {
- delete (static_cast <SingleApplication*>( QCoreApplication::instance() ))->d_ptr;
- ::exit( 128 + signum );
- }
-#endif
-
/**
* @brief Executed when a connection has been made to the LocalServer
*/
diff --git a/singleapplication_p.h b/singleapplication_p.h
index 2969173..bbe6751 100644
--- a/singleapplication_p.h
+++ b/singleapplication_p.h
@@ -66,11 +66,6 @@ public:
quint16 blockChecksum();
qint64 primaryPid();
-#ifdef Q_OS_UNIX
- void crashHandler();
- [[noreturn]] static void terminate( int signum );
-#endif
-
SingleApplication *q_ptr;
QSharedMemory *memory;
QLocalSocket *socket;