title: Qt - simple Http server
body: <p>I have written simple Http server (only for getting and parsing requests).
  But it doesn't seems to work properly: sometimes i'm getting error "Access violation (c0000005)"</p>
  
  <p>UPD: i have followed suggestions and changed source:</p>
  
  <pre><code>Server::Server()
  {
      tcpServer = new QTcpServer();
      if (!tcpServer-&gt;listen(QHostAddress::Any, 1111)) {
          return;
      }
  
      QObject::connect(tcpServer, &amp;QTcpServer::newConnection, [=]() {
          QTcpSocket *clientSocket = tcpServer-&gt;nextPendingConnection();
          QObject::connect(clientSocket, &amp;QTcpSocket::disconnected, clientSocket, &amp;QTcpSocket::deleteLater);
  
          QObject::connect(clientSocket, &amp;QTcpSocket::readyRead, [this, clientSocket]() {
              const QString line = QUrl::fromPercentEncoding(clientSocket-&gt;readLine());
              clientSocket-&gt;disconnectFromHost();
              const QStringList tokens = QString(line).split(QRegExp("[ \r\n][ \r\n]*"));
  
  
              if (parseParams(tokens)) {
                  emit Server::newRequest(params);
              }
          });
      });
  }
  </code></pre>
  
  <p>Will this code never throw an error "Access violation (c0000005)"?</p>