Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
fix: fixed static global variable causing variable content overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
QxQ authored and QxQ committed Sep 22, 2020
1 parent 6d7761e commit 982e2ec
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(CMAKE_AUTORCC ON)
find_package(Qt5 COMPONENTS Core Widgets Gui REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(QVPLUGIN_INTERFACE_INCLUDE_DIR "interface/")
include(interface/QvPluginInterface.cmake)
include(interface/QvGUIPluginInterface.cmake)
include_directories(${QVPLUGIN_INTERFACE_INCLUDE_DIR})
Expand Down
1 change: 1 addition & 0 deletions TrojanGoPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
bool QvTrojanGoPlugin::InitializePlugin(const QString &, const QJsonObject &)
{
emit PluginLog("Initialize plugin.");
PluginInstance = this;
outboundHandler = std::make_shared<TrojanGoSerializer>();
eventHandler = std::make_shared<SimpleEventHandler>();
kernelInterface = std::make_unique<TrojanGoPluginKernelInterface>();
Expand Down
5 changes: 3 additions & 2 deletions TrojanGoPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ using namespace Qv2rayPlugin;

class QvTrojanGoPlugin
: public QObject
, Qv2rayInterface
, public Qv2rayInterface
{
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
Q_OBJECT
public:
//
// Basic metainfo of this plugin
const QvPluginMetadata GetMetadata() const override
{
Expand All @@ -43,3 +42,5 @@ class QvTrojanGoPlugin
void PluginLog(const QString &) const override;
void PluginErrorMessageBox(const QString &, const QString &) const override;
};

inline QvTrojanGoPlugin *PluginInstance;
4 changes: 2 additions & 2 deletions core/Kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ QvTrojanGoPluginKernel::QvTrojanGoPluginKernel() : Qv2rayPlugin::PluginKernel()

bool QvTrojanGoPluginKernel::StartKernel()
{
const auto executablePath = pluginInstance->GetSettngs()["kernelPath"].toString();
const auto executablePath = PluginInstance->GetSettngs()["kernelPath"].toString();
if (!QFile::exists(executablePath))
{
pluginInstance->PluginErrorMessageBox(tr("Stupid Configuration?"),
PluginInstance->PluginErrorMessageBox(tr("Stupid Configuration?"),
tr("We cannot find your Trojan-Go kernel. Please configure it in the plugin settings."));
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion interface

0 comments on commit 982e2ec

Please sign in to comment.