diff options
author | Kurt Pattyn <pattyn.kurt@gmail.com> | 2014-02-02 23:38:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-03 00:06:12 +0100 |
commit | 97b9d19626a094ca3b0eafa45112861d4a5e1586 (patch) | |
tree | 30d235aee4df29f338f5b3901753116b5d859694 /examples/simplechat/chatserver.cpp | |
parent | 4147e9adf0beb4ed68835c56bb2d5371f37c192a (diff) | |
download | qtwebsockets-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.cpp | 9 |
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] |