From 226f2c966a06e583a3904fd3eecb9da75dc635dd Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Fri, 13 Feb 2015 15:58:54 +0000 Subject: [PATCH] assigned arch static instance instead of create a new one #4313 --- src/lib/arch/Arch.h | 2 ++ src/lib/plugin/ns/ns.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/arch/Arch.h b/src/lib/arch/Arch.h index bc624131..6417f968 100644 --- a/src/lib/arch/Arch.h +++ b/src/lib/arch/Arch.h @@ -120,6 +120,8 @@ public: */ static Arch* getInstance(); + static void setInstance(Arch* s) { s_instance = s; } + ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; } ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; } diff --git a/src/lib/plugin/ns/ns.cpp b/src/lib/plugin/ns/ns.cpp index 84e20b1e..c3bf1c33 100644 --- a/src/lib/plugin/ns/ns.cpp +++ b/src/lib/plugin/ns/ns.cpp @@ -39,7 +39,7 @@ init(void* log, void* arch) } if (g_arch == NULL) { - g_arch = new Arch(reinterpret_cast(arch)); + Arch::setInstance(reinterpret_cast(arch)); } }