Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-60158

Add a mode to Q*Server classes to return connections that are automatically deleted when disconnected

XMLWordPrintable

      There are several classes in Qt with a member function of this form: Q*Server::nextPending*Connection():

      • QTcpServer
      • QLocalServer
      • QSctpServer
      • QWebSocketServer
      • QBluetoothServer

      Most of these classes return a connection object owned by the server. But since it is quite likely that a server is much more long-lived than the connections it returned, it is recommended in the documentation that connection objects should be deleted by the user when they are no more needed.

      IMHO it is safe to assume that most of the users don't reuse the objects returned by one of these servers. Also most users probably connect a connection object's disconnected() signal to its deleteLater() slot as soon as they receive it from the server.

      It would be good if these servers had a mode which, if enabled, let the server return a connection object whose disconnected() signal is already connected to its deleteLater() slot. This would be a better convenience than making the server the parent of the returned object which is automatically done by most of these server classes although, in general, the lifetime of the server shouldn't limit the lifetime of the connection it established.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ablasche Alex Blasche
            ckakman Kayra Akman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes