Ok, this is enough :)

09.01.2016 18:49, Thiago Macieira пишет:
On Saturday 09 January 2016 17:30:37 Denis Shienkov wrote:
E.g. we can look on
\qtbase\tests\auto\network\socket\qtcpsocket\tst_qtcpsocket.cpp as example,
where in each test are used the new/delete:

void tst_QTcpSocket::foo()
{
      QTcpSocket *socket = new QTcpSocket;
      // make tests
      delete socket;
}
Because they are not like that.

Here's an actual copy/paste from the test:

void tst_QTcpSocket::waitForReadyReadInASlot()
{
     QTcpSocket *socket = newSocket();
     [... other code ...]
     delete socket;
}

What's the difference?

QTcpSocket *tst_QTcpSocket::newSocket() const
{
     QTcpSocket *socket;
#ifndef QT_NO_SSL
     QFETCH_GLOBAL(bool, ssl);
     socket = ssl ? new QSslSocket : new QTcpSocket;
#else
     socket = new QTcpSocket;
#endif


_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to