On 14 January 2018 at 19:49, Adrien LERAVAT <[email protected]> wrote: > With the clear drawback of explicit memory management needed by users. We > made > > some tests with a container/RAII object for the reply, and it seems fine, > but before > > moving forward in this limited timeframe, we wanted to have your feedback. > > Sample below: > > > \code > > QCoapClient client; > > QCoapRequest request = client.get(QUrl("1.2.3.4:5683")); > > connect(request.reply(), &QCoapReply::finished, this, &MyClass::onFinished); > > ... > > MyClass::onFinished(const QCoapRequest &request) > > { > > qWarning() << request.reply()->readAll(); > > } > > \endcode > > > In that case, the QCoapReply life is managed with a > QSharedPointer<QCoapReply> in the request. > > QCoapRequest does not inherit from QObject. Anyone sees a problem with this > approach?
Doing automatic cleanup is certainly an improvement, but in addition to that, I think it's useful if the user can explicitly cleanup as well, as soon as she's done with the reply, without waiting for the lifetime of the request to end. _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
