Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
2d8078a0
Commit
2d8078a0
authored
3 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
runguard: enable on linux
GitLab:
#350
GitLab:
#439
Change-Id: Iba420995401cb4a8c20f3611473eb6f5bd22334b
parent
64720224
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/runguard.cpp
+9
-5
9 additions, 5 deletions
src/runguard.cpp
src/runguard.h
+2
-2
2 additions, 2 deletions
src/runguard.h
with
11 additions
and
7 deletions
src/runguard.cpp
+
9
−
5
View file @
2d8078a0
...
...
@@ -22,6 +22,7 @@
#include
"mainapplication.h"
#include
<QCryptographicHash>
#include
<QLocalSocket>
namespace
{
...
...
@@ -77,16 +78,16 @@ RunGuard::isAnotherRunning()
bool
RunGuard
::
tryToRun
()
{
#ifdef Q_OS_WIN
if
(
isAnotherRunning
())
{
/*
* This is a secondary instance,
* connect to the primary instance to trigger a restore
* then fail.
*/
if
(
socket_
==
nullptr
)
{
if
(
!
socket_
)
socket_
=
new
QLocalSocket
();
}
if
(
!
socket_
)
return
false
;
if
(
socket_
->
state
()
==
QLocalSocket
::
UnconnectedState
||
socket_
->
state
()
==
QLocalSocket
::
ClosingState
)
{
socket_
->
connectToServer
(
key_
);
...
...
@@ -94,7 +95,11 @@ RunGuard::tryToRun()
if
(
socket_
->
state
()
==
QLocalSocket
::
ConnectingState
)
{
socket_
->
waitForConnected
();
}
return
false
;
if
(
socket_
->
state
()
==
QLocalSocket
::
ConnectedState
)
{
return
false
;
}
// If not connected, this means that the server doesn't exists
// and the app can be relaunched (can be the case after a client crash or Ctrl+C)
}
memLock_
.
acquire
();
...
...
@@ -117,7 +122,6 @@ RunGuard::tryToRun()
&
QLocalServer
::
newConnection
,
this
,
&
RunGuard
::
tryRestorePrimaryInstance
);
#endif
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/runguard.h
+
2
−
2
View file @
2d8078a0
...
...
@@ -52,8 +52,8 @@ private:
QSharedMemory
sharedMem_
;
QSystemSemaphore
memLock_
;
QLocalSocket
*
socket_
;
QLocalServer
*
server_
;
QLocalSocket
*
socket_
{
nullptr
}
;
QLocalServer
*
server_
{
nullptr
}
;
Q_DISABLE_COPY
(
RunGuard
)
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment