Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/ulalaca-xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGyuhwan Park <unstabler@unstabler.pl>2022-05-24 16:53:37 +0300
committerGyuhwan Park <unstabler@unstabler.pl>2022-05-24 16:53:37 +0300
commit45cb4955cc52b928d639c6476ce030419dcadc3a (patch)
tree3b9c0e5f1330b446699cc7721d6fe1fc56c54b3c
parent565adc4ca9e366b4c41c99c45f5a2a4c50f27efc (diff)
fix(ulalaca): stop thread and release resources when session is closed
-rw-r--r--ProjectionThread.cpp11
-rw-r--r--ulalaca.cpp5
2 files changed, 15 insertions, 1 deletions
diff --git a/ProjectionThread.cpp b/ProjectionThread.cpp
index ff18187..8ebac61 100644
--- a/ProjectionThread.cpp
+++ b/ProjectionThread.cpp
@@ -35,11 +35,20 @@ void ProjectionThread::start() {
}
void ProjectionThread::stop() {
- _ipcConnection.disconnect();
_isTerminated = true;
+
+ if (_projectorThread.joinable()) {
+ _projectorThread.join();
+ }
+
+ _ipcConnection.disconnect();
}
void ProjectionThread::handleEvent(XrdpEvent &event) {
+ if (_isTerminated) {
+ return;
+ }
+
if (event.isKeyEvent()) {
auto keycode = event.param3;
auto cgKeycode = rdpKeycodeToCGKeycode(keycode);
diff --git a/ulalaca.cpp b/ulalaca.cpp
index 930108b..d80ab3c 100644
--- a/ulalaca.cpp
+++ b/ulalaca.cpp
@@ -155,6 +155,11 @@ int XrdpUlalaca::lib_mod_signal(XrdpUlalaca *_this) {
int XrdpUlalaca::lib_mod_end(XrdpUlalaca *_this) {
LOG(LOG_LEVEL_INFO, "lib_mod_end() called");
+
+ if (_this->_projectionThread != nullptr) {
+ _this->_projectionThread->stop();
+ }
+
return 0;
}