commit
a3a62165e9
126 changed files with 375 additions and 45 deletions
|
|
@ -940,8 +940,8 @@ void SshConnectionPrivate::connectToHost()
|
|||
this, &SshConnectionPrivate::handleSocketConnected);
|
||||
connect(m_socket, &QIODevice::readyRead,
|
||||
this, &SshConnectionPrivate::handleIncomingData);
|
||||
connect(m_socket, &QAbstractSocket::errorOccurred,
|
||||
this, &SshConnectionPrivate::handleSocketError);
|
||||
//connect(m_socket, &QAbstractSocket::errorOccurred,
|
||||
// this, &SshConnectionPrivate::handleSocketError);
|
||||
connect(m_socket, &QAbstractSocket::disconnected,
|
||||
this, &SshConnectionPrivate::handleSocketDisconnected);
|
||||
connect(&m_timeoutTimer, &QTimer::timeout, this, &SshConnectionPrivate::handleTimeout);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ include("3rd/QtSsh/src/ssh/qssh.pri")
|
|||
include("3rd/QtSsh/src/botan/botan.pri")
|
||||
!android:!ios:include("3rd/SingleApplication/singleapplication.pri")
|
||||
include ("3rd/SortFilterProxyModel/SortFilterProxyModel.pri")
|
||||
include("3rd/QZXing/src/QZXing-components.pri")
|
||||
include("3rd/qzxing/src/QZXing-components.pri")
|
||||
|
||||
INCLUDEPATH += $$PWD/3rd/OpenSSL/include
|
||||
DEPENDPATH += $$PWD/3rd/OpenSSL/include
|
||||
|
|
@ -38,6 +38,7 @@ HEADERS += \
|
|||
debug.h \
|
||||
defines.h \
|
||||
managementserver.h \
|
||||
platforms/linux/leakdetector.h \
|
||||
protocols/protocols_defs.h \
|
||||
settings.h \
|
||||
ui/notificationhandler.h \
|
||||
|
|
@ -93,6 +94,7 @@ SOURCES += \
|
|||
debug.cpp \
|
||||
main.cpp \
|
||||
managementserver.cpp \
|
||||
platforms/linux/leakdetector.cpp \
|
||||
protocols/protocols_defs.cpp \
|
||||
settings.cpp \
|
||||
ui/notificationhandler.cpp \
|
||||
|
|
@ -190,9 +192,10 @@ macx {
|
|||
|
||||
linux:!android {
|
||||
DEFINES += MVPN_LINUX
|
||||
|
||||
LIBS += /usr/lib/x86_64-linux-gnu/libcrypto.a
|
||||
LIBS += /usr/lib/x86_64-linux-gnu/libssl.a
|
||||
|
||||
INCLUDEPATH += $$PWD/platforms/linux
|
||||
}
|
||||
|
||||
win32|macx|linux:!android {
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
|
|||
}
|
||||
|
||||
#elif defined (Q_OS_LINUX)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
#else
|
||||
return false;
|
||||
|
|
|
|||
75
client/platforms/linux/leakdetector.cpp
Normal file
75
client/platforms/linux/leakdetector.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "leakdetector.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef MVPN_DEBUG
|
||||
static QMutex s_leakDetector;
|
||||
|
||||
QHash<QString, QHash<void*, uint32_t>> s_leaks;
|
||||
#endif
|
||||
|
||||
LeakDetector::LeakDetector() {
|
||||
#ifndef MVPN_DEBUG
|
||||
qFatal("LeakDetector _must_ be created in debug builds only!");
|
||||
#endif
|
||||
}
|
||||
|
||||
LeakDetector::~LeakDetector() {
|
||||
#ifdef MVPN_DEBUG
|
||||
QTextStream out(stderr);
|
||||
|
||||
out << "== Mozilla VPN - Leak report ===================" << Qt::endl;
|
||||
|
||||
bool hasLeaks = false;
|
||||
for (auto i = s_leaks.begin(); i != s_leaks.end(); ++i) {
|
||||
QString className = i.key();
|
||||
|
||||
if (i->size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
hasLeaks = true;
|
||||
out << className << Qt::endl;
|
||||
|
||||
for (auto l = i->begin(); l != i->end(); ++l) {
|
||||
out << " - ptr: " << l.key() << " size:" << l.value() << Qt::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasLeaks) {
|
||||
out << "No leaks detected." << Qt::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MVPN_DEBUG
|
||||
void LeakDetector::logCtor(void* ptr, const char* typeName, uint32_t size) {
|
||||
QMutexLocker lock(&s_leakDetector);
|
||||
|
||||
QString type(typeName);
|
||||
if (!s_leaks.contains(type)) {
|
||||
s_leaks.insert(type, QHash<void*, uint32_t>());
|
||||
}
|
||||
|
||||
s_leaks[type].insert(ptr, size);
|
||||
}
|
||||
|
||||
void LeakDetector::logDtor(void* ptr, const char* typeName, uint32_t size) {
|
||||
QMutexLocker lock(&s_leakDetector);
|
||||
|
||||
QString type(typeName);
|
||||
Q_ASSERT(s_leaks.contains(type));
|
||||
|
||||
QHash<void*, uint32_t>& leak = s_leaks[type];
|
||||
Q_ASSERT(leak.contains(ptr));
|
||||
Q_ASSERT(leak[ptr] == size);
|
||||
leak.remove(ptr);
|
||||
}
|
||||
#endif
|
||||
41
client/platforms/linux/leakdetector.h
Normal file
41
client/platforms/linux/leakdetector.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef LEAKDETECTOR_H
|
||||
#define LEAKDETECTOR_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#ifdef MVPN_DEBUG
|
||||
# define MVPN_COUNT_CTOR(_type) \
|
||||
do { \
|
||||
static_assert(std::is_class<_type>(), \
|
||||
"Token '" #_type "' is not a class type."); \
|
||||
LeakDetector::logCtor((void*)this, #_type, sizeof(*this)); \
|
||||
} while (0)
|
||||
|
||||
# define MVPN_COUNT_DTOR(_type) \
|
||||
do { \
|
||||
static_assert(std::is_class<_type>(), \
|
||||
"Token '" #_type "' is not a class type."); \
|
||||
LeakDetector::logDtor((void*)this, #_type, sizeof(*this)); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
# define MVPN_COUNT_CTOR(_type)
|
||||
# define MVPN_COUNT_DTOR(_type)
|
||||
#endif
|
||||
|
||||
class LeakDetector {
|
||||
public:
|
||||
LeakDetector();
|
||||
~LeakDetector();
|
||||
|
||||
#ifdef MVPN_DEBUG
|
||||
static void logCtor(void* ptr, const char* typeName, uint32_t size);
|
||||
static void logDtor(void* ptr, const char* typeName, uint32_t size);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // LEAKDETECTOR_H
|
||||
|
|
@ -11,10 +11,6 @@
|
|||
# include "platforms/android/android_notificationhandler.h"
|
||||
#else
|
||||
|
||||
# if defined(Q_OS_LINUX)
|
||||
# include "platforms/linux/linuxsystemtraynotificationhandler.h"
|
||||
# endif
|
||||
|
||||
# include "systemtray_notificationhandler.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -27,9 +23,9 @@ NotificationHandler* NotificationHandler::create(QObject* parent) {
|
|||
#else
|
||||
|
||||
# if defined(Q_OS_LINUX)
|
||||
if (LinuxSystemTrayNotificationHandler::requiredCustomImpl()) {
|
||||
return new LinuxSystemTrayNotificationHandler(parent);
|
||||
}
|
||||
//if (LinuxSystemTrayNotificationHandler::requiredCustomImpl()) {
|
||||
// return new LinuxSystemTrayNotificationHandler(parent);
|
||||
//}
|
||||
# endif
|
||||
|
||||
return new SystemTrayNotificationHandler(parent);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include "../uilogic.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
ShareConnectionLogic::ShareConnectionLogic(UiLogic *logic, QObject *parent):
|
||||
PageLogicBase(logic, parent),
|
||||
m_textEditShareOpenVpnCodeText{},
|
||||
|
|
|
|||
|
|
@ -46,29 +46,6 @@ SystemTrayNotificationHandler::SystemTrayNotificationHandler(QObject* parent) :
|
|||
|
||||
m_systemTrayIcon.setContextMenu(&m_menu);
|
||||
setTrayState(VpnProtocol::Disconnected);
|
||||
|
||||
|
||||
// m_preferencesAction = m_menu.addAction("", vpn, &MozillaVPN::requestSettings);
|
||||
|
||||
// m_menu.addSeparator();
|
||||
|
||||
// m_quitAction = m_menu.addAction("", vpn->controller(), &Controller::quit);
|
||||
// m_systemTrayIcon.setContextMenu(&m_menu);
|
||||
|
||||
// updateIcon(vpn->statusIcon()->iconString());
|
||||
|
||||
// connect(QmlEngineHolder::instance()->window(), &QWindow::visibleChanged, this,
|
||||
// &SystemTrayNotificationHandler::updateContextMenu);
|
||||
|
||||
// connect(&m_systemTrayIcon, &QSystemTrayIcon::activated, this,
|
||||
// &SystemTrayNotificationHandler::maybeActivated);
|
||||
|
||||
// connect(&m_systemTrayIcon, &QSystemTrayIcon::messageClicked, this,
|
||||
// &SystemTrayNotificationHandler::messageClickHandle);
|
||||
|
||||
// retranslate();
|
||||
|
||||
// m_systemTrayIcon.show();
|
||||
}
|
||||
|
||||
SystemTrayNotificationHandler::~SystemTrayNotificationHandler() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue