summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMårten Nordheim <[email protected]>2023-06-14 20:30:00 +0200
committerMårten Nordheim <[email protected]>2023-06-22 16:04:42 +0200
commit0471df79871bd9e12c8b7e17f0ebe360bdba2be9 (patch)
tree8d1f2052760eef77e60a4df44d7f17698fca654a /examples
parent5a6f51a322f09c96b98adb5ea3355b78d606398f (diff)
Network-chat example: Only disconnect if still connected
If we are already disconnected we end up printing warnings about how it's illegal to call waitForBytesWritten on an unconnected socket Change-Id: I8c864d105d5372edfee84affb362cca3021b8ea0 Reviewed-by: Konrad Kujawa <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'examples')
-rw-r--r--examples/network/network-chat/connection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/network/network-chat/connection.cpp b/examples/network/network-chat/connection.cpp
index 414faa80a91..f24e0e2a0b7 100644
--- a/examples/network/network-chat/connection.cpp
+++ b/examples/network/network-chat/connection.cpp
@@ -48,7 +48,7 @@ Connection::Connection(qintptr socketDescriptor, QObject *parent)
Connection::~Connection()
{
- if (isGreetingMessageSent) {
+ if (isGreetingMessageSent && QAbstractSocket::state() != QAbstractSocket::UnconnectedState) {
// Indicate clean shutdown.
writer.endArray();
waitForBytesWritten(2000);