[Qt-interest] QNetworkAccessManager and a QHash of QNetworkReply pointers
Juha Ruotsalainen
juha.ruotsalainen at fastroi.fi
Mon Sep 6 13:15:36 CEST 2010
>
> If networkReplies.remove(reply) is not being called from any other
> place, this should work. Does networkReplies.contins(reply) return
> true here?
Yes, it returned true.
>
> > 4. The removal shield provided removeReply is the method with which
> the code now works.
> >
> > 5. The point where the application had the access violation exception
> was when the user pressed a button on UI that should reset the
> application state. Resetting the application state requires that the
> networkReplies hash is looped through and each network reply's abort
> and deletelater are called.
>
> While iterating the hash, are you removing the item in the loop too?
Nope.
> Removing items in a loop can cause problems if you're using a
> read-only (java style) iterator. CMIIW.
>
> Safe approach would be to abort all replies in the loop and then call
> clear() on the hash to remove all items at once.
This is what we did.
Cheers,
--
jussi
More information about the Qt-interest-old
mailing list