summaryrefslogtreecommitdiff
path: root/examples/simplechat/chatserver.cpp
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2014-02-02 23:38:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-03 00:06:12 +0100
commit97b9d19626a094ca3b0eafa45112861d4a5e1586 (patch)
tree30d235aee4df29f338f5b3901753116b5d859694 /examples/simplechat/chatserver.cpp
parent4147e9adf0beb4ed68835c56bb2d5371f37c192a (diff)
downloadqtwebsockets-97b9d19626a094ca3b0eafa45112861d4a5e1586.tar.gz
Add cleanup to examples
Change-Id: I28b9007a6d35575b11a608645930fa2ed71e7c7c Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Diffstat (limited to 'examples/simplechat/chatserver.cpp')
-rw-r--r--examples/simplechat/chatserver.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/simplechat/chatserver.cpp b/examples/simplechat/chatserver.cpp
index 0e1a0e5..0ca4b47 100644
--- a/examples/simplechat/chatserver.cpp
+++ b/examples/simplechat/chatserver.cpp
@@ -61,6 +61,15 @@ ChatServer::ChatServer(quint16 port, QObject *parent) :
this, &ChatServer::onNewConnection);
}
}
+
+ChatServer::~ChatServer()
+{
+ m_pWebSocketServer->close();
+ while (!m_clients.isEmpty()) {
+ QWebSocket *pWebSocket = m_clients.takeFirst();
+ delete pWebSocket;
+ }
+}
//! [constructor]
//! [onNewConnection]