[Development] API review for a new QDnsResolver class

Peter Hartmann peter.hartmann at nokia.com
Wed Nov 9 19:21:14 CET 2011


On 11/09/2011 06:43 PM, ext Jeremy Lainé wrote:
> (...)
> A/ static QDnsReply* QDnsReply::lookup(QDnsReply::Type, QString);
>
> pro: easy to connect to the QDnsReply's signal
> con: it's entirely up to the user to handle deletion. Judging by your comments above, I
> doubt you favor it?
>
> or
>
> B/ static QSharedPointer<QDnsReply>  QDnsReply::lookup(QDnsReply::Type, QString);
>
> pro: memory ownership is explicit
> con: how used are our users to manipulating QSharedPointer with respect to signals and such?

I rather favour option B (lessons learned from QNAM), because I think 
option A might lead to undeleted replies, which is what we experienced 
in the case of
QNetworkReply *QNetworkAccessmanager::get(...).

We probably can mitigate the complexity introduced by QSharedPointer by 
having a simple example in the documentation.

However if people more favour option A, that would not be a problem for 
me either.

Peter

>
> Jeremy
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development


-- 
Qt Developer Days 2011 – REGISTER NOW!
October 24 – 26, Munich
November 29 – December 1, San Francisco
Learn more and Register at http://qt.nokia.com/qtdevdays2011



More information about the Development mailing list