all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 29aef4b7135a94ec8f7679c35af9ca69f879721a 4823 bytes (raw)
name: gnu/packages/patches/linphoneqt-mutex.patch 	 # note: path name is non-authoritative(*)

  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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 
From 03bed40d638d09f36deb9e0ec3ad1fe1d10e139f Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Apr 2020 17:13:20 -0400
Subject: [PATCH] test 2

---
 .../single-application/SingleApplication.cpp  | 63 ++-----------------
 .../SingleApplicationPrivate.hpp              |  3 -
 2 files changed, 5 insertions(+), 61 deletions(-)

diff --git a/src/app/single-application/SingleApplication.cpp b/src/app/single-application/SingleApplication.cpp
index 29538ae3..1e6ab396 100644
--- a/src/app/single-application/SingleApplication.cpp
+++ b/src/app/single-application/SingleApplication.cpp
@@ -35,7 +35,6 @@
 
 #ifdef Q_OS_UNIX
   #include <signal.h>
-  #include <unistd.h>
 #endif // ifdef Q_OS_UNIX
 
 #ifdef Q_OS_WIN
@@ -135,10 +134,9 @@ void SingleApplicationPrivate::genBlockServerName (int timeout) {
 
 void SingleApplicationPrivate::startPrimary (bool resetMemory) {
   #ifdef Q_OS_UNIX
-    // Handle any further termination signals to ensure the
-    // QSharedMemory block is deleted even if the process crashes
-    crashHandler();
+    signal(SIGINT, SingleApplicationPrivate::terminate);
   #endif // ifdef Q_OS_UNIX
+
   // Successful creation means that no main process exists
   // So we start a QLocalServer to listen for connections
   QLocalServer::removeServer(blockServerName);
@@ -178,9 +176,7 @@ void SingleApplicationPrivate::startPrimary (bool resetMemory) {
 
 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();
+    signal(SIGINT, SingleApplicationPrivate::terminate);
   #endif // ifdef Q_OS_UNIX
 }
 
@@ -222,60 +218,11 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
 }
 
 #ifdef Q_OS_UNIX
-  void SingleApplicationPrivate::crashHandler () {
-    // This guarantees the program will work even with multiple
-    // instances of SingleApplication in different threads.
-    // Which in my opinion is idiotic, but lets handle that too.
-    {
-      sharedMemMutex.lock();
-      sharedMem.append(this);
-      sharedMemMutex.unlock();
-    }
-
-    // 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
-  }
 
   void SingleApplicationPrivate::terminate (int signum) {
-    if (signum == SIGINT) {
-      SingleApplication::instance()->quit();
-      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);
+    Q_UNUSED(signum);
+    SingleApplication::instance()->quit();
   }
-
-  QList<SingleApplicationPrivate *> SingleApplicationPrivate::sharedMem;
-  QMutex SingleApplicationPrivate::sharedMemMutex;
 #endif // ifdef Q_OS_UNIX
 
 /**
diff --git a/src/app/single-application/SingleApplicationPrivate.hpp b/src/app/single-application/SingleApplicationPrivate.hpp
index d0dfc10e..db2d8cf5 100644
--- a/src/app/single-application/SingleApplicationPrivate.hpp
+++ b/src/app/single-application/SingleApplicationPrivate.hpp
@@ -59,10 +59,7 @@ public:
   void connectToPrimary (int msecs, char connectionType);
 
   #ifdef Q_OS_UNIX
-    void crashHandler ();
     static void terminate (int signum);
-    static QList<SingleApplicationPrivate *> sharedMem;
-    static QMutex sharedMemMutex;
   #endif // ifdef Q_OS_UNIX
 
   QSharedMemory *memory;
-- 
2.17.1


debug log:

solving 29aef4b713 ...
found 29aef4b713 in https://yhetil.org/guix/48c4a04dff5589ada795e823ed045dee@disroot.org/

applying [1/1] https://yhetil.org/guix/48c4a04dff5589ada795e823ed045dee@disroot.org/
diff --git a/gnu/packages/patches/linphoneqt-mutex.patch b/gnu/packages/patches/linphoneqt-mutex.patch
new file mode 100644
index 0000000000..29aef4b713

1:22: trailing whitespace.
 
1:27: trailing whitespace.
 
1:30: trailing whitespace.
 
1:43: trailing whitespace.
 
1:52: trailing whitespace.
 
Checking patch gnu/packages/patches/linphoneqt-mutex.patch...
Applied patch gnu/packages/patches/linphoneqt-mutex.patch cleanly.
warning: squelched 7 whitespace errors
warning: 12 lines add whitespace errors.

index at:
100644 29aef4b7135a94ec8f7679c35af9ca69f879721a	gnu/packages/patches/linphoneqt-mutex.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.