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

Commit 9095a02

Browse files
QxQQxQ
authored andcommitted
fix: fixed static global variable causing variable content overwrite
1 parent a646fa6 commit 9095a02

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CommandPlugin.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ using namespace Qv2rayPlugin;
1111

1212
class CommandPlugin
1313
: public QObject
14-
, Qv2rayInterface
14+
, public Qv2rayInterface
1515
{
1616
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
1717
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
@@ -41,3 +41,5 @@ class CommandPlugin
4141
void PluginLog(const QString &) const override;
4242
void PluginErrorMessageBox(const QString &, const QString &) const override;
4343
};
44+
45+
DECLARE_PLUGIN_INSTANCE(CommandPlugin);

core/EventHandler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ QvPlugin_EventHandler(SimpleEventHandler, Connectivity)
1414
/// $$INBOUND_inboundProtocol
1515
/// --> port for that protocol, (e.g. $INBOUND_http as HTTP port)
1616
///
17-
const auto settings = CommandPluginConfig::fromJson(pluginInstance->GetSettngs());
17+
const auto settings = CommandPluginConfig::fromJson(CommandPluginInstance->GetSettngs());
1818

1919
QStringList actions;
2020
switch (pluginEvent.eventType)
@@ -55,7 +55,7 @@ QvPlugin_EventHandler(SimpleEventHandler, Connectivity)
5555
auto returnvalue = QProcess::execute(_command);
5656
if (returnvalue != 0)
5757
{
58-
pluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
58+
CommandPluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
5959
}
6060
}
6161
else
@@ -71,7 +71,7 @@ QvPlugin_EventHandler(SimpleEventHandler, SystemProxy)
7171
/// $$HTTP: HTTP port (could be 0)
7272
/// $$SOCKS: SOCKS port (could be 0)
7373
///
74-
const auto settings = CommandPluginConfig::fromJson(pluginInstance->GetSettngs());
74+
const auto settings = CommandPluginConfig::fromJson(CommandPluginInstance->GetSettngs());
7575
QStringList actions;
7676
switch (pluginEvent.systemProxyState)
7777
{
@@ -98,7 +98,7 @@ QvPlugin_EventHandler(SimpleEventHandler, SystemProxy)
9898
auto returnvalue = QProcess::execute(_command);
9999
if (returnvalue != 0)
100100
{
101-
pluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
101+
CommandPluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
102102
}
103103
}
104104
else
@@ -114,7 +114,7 @@ QvPlugin_EventHandler(SimpleEventHandler, ConnectionEntry)
114114
/// $$DISPLAYNAME
115115
/// $$ORIGINAL_NAME
116116
///
117-
const auto settings = CommandPluginConfig::fromJson(pluginInstance->GetSettngs());
117+
const auto settings = CommandPluginConfig::fromJson(CommandPluginInstance->GetSettngs());
118118
QStringList actions;
119119
switch (pluginEvent.eventType)
120120
{
@@ -156,7 +156,7 @@ QvPlugin_EventHandler(SimpleEventHandler, ConnectionEntry)
156156
auto returnvalue = QProcess::execute(_command);
157157
if (returnvalue != 0)
158158
{
159-
pluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
159+
CommandPluginInstance->PluginLog("Failed to execute command : \"" + action + "\"");
160160
}
161161
}
162162
else

0 commit comments

Comments
 (0)