fix: console client mem leak.

This commit is contained in:
2025-10-23 11:43:49 +08:00
parent ebab76ea3b
commit 342b495cca

View File

@@ -1,7 +1,8 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <Util.h> #include <Util.h>
#include <iostream>
#include <fversion.h> #include <fversion.h>
#include <iostream>
#include <memory>
#include "Console.h" #include "Console.h"
@@ -25,11 +26,11 @@ int main(int argc, char* argv[])
Util::InitLogger("frelayConsole.log", "frelayConsole"); Util::InitLogger("frelayConsole.log", "frelayConsole");
qInstallMessageHandler(Util::ConsoleMsgHander); qInstallMessageHandler(Util::ConsoleMsgHander);
auto* core = new ClientCore(); auto core = std::make_shared<ClientCore>();
auto* helper = new ConsoleHelper(); auto helper = std::make_shared<ConsoleHelper>();
helper->SetIpPort(argv[1], QString("%1").arg(argv[2]).toInt()); helper->SetIpPort(argv[1], QString("%1").arg(argv[2]).toInt());
helper->RunWorker(core); helper->RunWorker(core.get());
helper->Connect(); helper->Connect();
return app.exec(); return app.exec();