Commit e862ad95 authored by Oleg `Kanedias` Chernovskiy's avatar Oleg `Kanedias` Chernovskiy Committed by Oleg `Kanedias` Chernovskiy
Browse files

[KRDC-1] Use current thread instead of TLS to it

Current implementation relies on setting current thread pointer inside
the thread-local storage of current thread itself. We don't need this
workaround as we only ever need to get a pointer to the thread and it
can be done without relying on TLS.
parent 99f5ff34
......@@ -30,12 +30,10 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <QMutexLocker>
#include <QThreadStorage>
#include <QTimer>
//for detecting intel AMT KVM vnc server
static const QString INTEL_AMT_KVM_STRING= QLatin1String("Intel(r) AMT KVM");
static QThreadStorage<VncClientThread **> instances;
static const QString INTEL_AMT_KVM_STRING = QLatin1String("Intel(r) AMT KVM");
// Dispatch from this static callback context to the member context.
rfbBool VncClientThread::newclientStatic(rfbClient *cl)
......@@ -85,11 +83,12 @@ rfbCredential *VncClientThread::credentialHandlerStatic(rfbClient *cl, int crede
// Dispatch from this static callback context to the member context.
void VncClientThread::outputHandlerStatic(const char *format, ...)
VncClientThread **t = instances.localData();
VncClientThread *t = qobject_cast<VncClientThread *>(QThread::currentThread());
va_list args;
va_start(args, format);
(*t)->outputHandler(format, args);
t->outputHandler(format, args);
......@@ -448,9 +447,6 @@ void VncClientThread::run()
QMutexLocker locker(&mutex);
VncClientThread **threadTls = new VncClientThread *();
*threadTls = this;
while (!m_stopped) { // try to connect as long as the server allows
m_passwordError = false;
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