Double finished emit

Issue #23 closed
Anders Kielsholm created an issue

When QJsonRpcHttpReply encounters an error, finished() will be emitted twice, both for networkReplyFinished() and networkReplyError(). From a isolated point of view you have now clue if the second finished() is from the same error or a new one without doing extra checks.

I think a simple solution would be to just return when we in networkReplyFinished() figure out it's an error - so we just let networkReplyError() deal with the reply (just as stated by // this should be handled by the networkReplyError slot).

Thanks in advance :)
Anders

Comments (4)

  1. Matt Broadstone

    Hey, thanks for the bug report. It turns out that finished is always called even if an error is encountered, so just emitting finished in the network reply's finished slot is enough here.

  2. Anders Kielsholm reporter

    You're welcome, and thanks for the lib - we just started using it :)

    Regarding whether finished() is emitted, we've always been a bit annoyed by the Qt documentation, where it says (for the error() signal): The finished() signal will probably follow, indicating that the connection is over. However, we have an idea that the only situations where finished() won't be emitted after error() is when you have an ongoing connection and it hopefully always will be emitted for http.

  3. Matt Broadstone

    @Anigif sounds good, please let me know if you run into a situation where this is not the case, we can easily add tests cases for it. Cheers

  4. Log in to comment