DiveShare patch

Salvo Tomaselli tiposchi at tiscali.it
Tue Oct 14 00:41:36 PDT 2014


Hello,


> I only have one issue: your code leaks memory if the user clicks the "Upload
> dive data" button twice before the request finishes, as in doUpload you
> simply assign the new QNetworkReply object to this->reply.
The button becomes invisible when it's pressed, so it can't really be pressed 
twice in a row.

> Nitpicking: we don't usually use the "this->" syntax, though I do see it in
> a few places in the current source code. Unless Dirk has a strong
> preference, I'd leave it.
Removed.

> 1) make the function take a const QByteArray &data
Done, but I think QByteArray internally shares memory so it only copies on 
write.

> Your code is going back and forth between QString and QByteArray, which is
> inefficient.
Now it just uses QByteArray


One thing that makes me uneasy now is this:

reply = WebServices::manager()->put(request, json_data);
QObject::connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));

What if the signal is emitted before the connect?

Best
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Export-to-DiveShare.patch
Type: text/x-patch
Size: 18717 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141014/257567a8/attachment-0001.bin>


More information about the subsurface mailing list