aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/socketspy/SocketSpyWindow.cpp8
-rw-r--r--src/modules/socketspy/libkvisocketspy.cpp14
2 files changed, 10 insertions, 12 deletions
diff --git a/src/modules/socketspy/SocketSpyWindow.cpp b/src/modules/socketspy/SocketSpyWindow.cpp
index ef213a874..47edbd4a0 100644
--- a/src/modules/socketspy/SocketSpyWindow.cpp
+++ b/src/modules/socketspy/SocketSpyWindow.cpp
@@ -31,12 +31,14 @@
#include "KviLocale.h"
#include "KviConsoleWindow.h"
-extern KviPointerList<SocketSpyWindow> * g_pSocketSpyWindowList;
+#include <unordered_set>
+
+extern std::unordered_set<SocketSpyWindow *> g_pSocketSpyWindowList;
SocketSpyWindow::SocketSpyWindow(KviConsoleWindow * lpConsole)
: KviWindow(KviWindow::SocketSpy, "socket_spy", lpConsole), KviIrcDataStreamMonitor(lpConsole->context())
{
- g_pSocketSpyWindowList->append(this);
+ g_pSocketSpyWindowList.insert(this);
m_pSplitter = new KviTalSplitter(Qt::Horizontal, this);
setObjectName("spysocket_splitter");
m_pIrcView = new KviIrcView(m_pSplitter, this);
@@ -46,7 +48,7 @@ SocketSpyWindow::SocketSpyWindow(KviConsoleWindow * lpConsole)
SocketSpyWindow::~SocketSpyWindow()
{
- g_pSocketSpyWindowList->removeRef(this);
+ g_pSocketSpyWindowList.erase(this);
}
void SocketSpyWindow::die()
diff --git a/src/modules/socketspy/libkvisocketspy.cpp b/src/modules/socketspy/libkvisocketspy.cpp
index 9ecaa2863..0ef6818be 100644
--- a/src/modules/socketspy/libkvisocketspy.cpp
+++ b/src/modules/socketspy/libkvisocketspy.cpp
@@ -29,8 +29,9 @@
#include "KviLocale.h"
#include <QSplitter>
+#include <unordered_set>
-KviPointerList<SocketSpyWindow> * g_pSocketSpyWindowList = nullptr;
+std::unordered_set<SocketSpyWindow *> g_pSocketSpyWindowList;
/*
@doc: socketspy.open
@@ -59,25 +60,20 @@ static bool socketspy_kvs_cmd_open(KviKvsModuleCommandCall * c)
static bool socketspy_module_init(KviModule * m)
{
- g_pSocketSpyWindowList = new KviPointerList<SocketSpyWindow>;
- g_pSocketSpyWindowList->setAutoDelete(false);
-
KVSM_REGISTER_SIMPLE_COMMAND(m, "open", socketspy_kvs_cmd_open);
return true;
}
static bool socketspy_module_cleanup(KviModule *)
{
- while(g_pSocketSpyWindowList->first())
- g_pSocketSpyWindowList->first()->die();
- delete g_pSocketSpyWindowList;
- g_pSocketSpyWindowList = nullptr;
+ for(auto & s : g_pSocketSpyWindowList)
+ s->die();
return true;
}
static bool socketspy_module_can_unload(KviModule *)
{
- return (g_pSocketSpyWindowList->isEmpty());
+ return (g_pSocketSpyWindowList.empty());
}
KVIRC_MODULE(