#include "vncclientthread.h"
+#include <QCoreApplication>
#include <QMutexLocker>
#include <QTimer>
const bool quitSuccess = wait(500);
- kDebug(5011) << "Quit VNC thread success:" << quitSuccess;
+ kDebug(5011) << "~VncClientThread(): Quit VNC thread success:" << quitSuccess;
delete [] frameBuffer;
+ //cl is free()d when event loop exits.
}
void VncClientThread::checkOutputErrorMessage()
void VncClientThread::stop()
{
- QMutexLocker locker(&mutex);
+//TODO: not locking the mutex leads to a crash, but at least it stops.
m_stopped = true;
}
{
QMutexLocker locker(&mutex);
+ int passwd_failures = 0;
while (!m_stopped) { // try to connect as long as the server allows
m_passwordError = false;
if (rfbInitClient(cl, 0, 0))
break;
- if (m_passwordError)
+ if (m_passwordError) {
+ passwd_failures++;
+ if(passwd_failures > 2)
+ m_stopped = true;
continue;
+ }
return;
}