Results 1 to 4 of 4

Thread: Multiple signals coming in when I get a QNetworkReply

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Multiple signals coming in when I get a QNetworkReply

    I seem to be getting multiples of the same signal when an event happens. I am using a NetworkAccessManager to do a post to a cgi. The post works fine but when I get the signal that the request is done and do my processing on it.

    The odd part is that if I do it multiple times I get a signal with an "empty" QNetworkReply. I get an extra for each previous post I have done to the cgi. So on the first one it works as expected. On the second I will get the expected result then an empty. On the third I will get the result and 2 emptys. The QNetworkReply is not really empty that is just what I am calling it.

    I am calling deleteLater on the replies. I also downloaded an example and it worked as expected. So it is something in my app but it is driving me crazy trying to find it. I am thinking it is also happening with other signals for probably the same reason.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Multiple signals coming in when I get a QNetworkReply

    Quote Originally Posted by huguley View Post
    So it is something in my app but it is driving me crazy trying to find it.
    Yet, you have the code. Imagine how crazy it will be for anyone else, someone who doesn't have your code, to find the error.

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Multiple signals coming in when I get a QNetworkReply

    Quote Originally Posted by tbscope View Post
    Yet, you have the code. Imagine how crazy it will be for anyone else, someone who doesn't have your code, to find the error.
    I would have posted some code but the relevent parts are scattered all over and it would be a big wall of text. It is likely a very noob mistake.

    I thought maybe it was holding onto the slots and signals connections so I put a disconnect in the destructor for the window but that did not change anything.

    I have a thread in the app which emits a signal that does not get multipled up so it has something to do with opening a window. If I don't close the window it works as expected. But after I close the window and reopen it then it will multiply again.

    What are some boneheaded ways to misuse qt? That is probably what I did.


    Added after 17 minutes:


    I figured it out. I was doing something boneheaded. I was not deleting the window after closing it. So there was an instance for each time I had opened the window in the background accepting the signal and doing stuff.

    Sometimes just having someone else to talk to about a problem be a big help. Thanks!
    Last edited by huguley; 26th October 2010 at 13:23.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Multiple signals coming in when I get a QNetworkReply

    Sounds awfully like you are connecting the QNetworkAccessManager::finished() signal to your signal handler each time you create a new request. One connect - one signal, then two connections and two signals, etc.

Similar Threads

  1. Replies: 5
    Last Post: 30th December 2009, 23:40
  2. slots/signals with QNetworkReply
    By timmu in forum Qt Programming
    Replies: 3
    Last Post: 24th August 2009, 14:26
  3. Replies: 0
    Last Post: 29th May 2009, 06:08
  4. Coming Soon: Qt Eclipse Integration
    By QiT in forum Qt-based Software
    Replies: 8
    Last Post: 25th May 2007, 14:48
  5. Replies: 14
    Last Post: 27th November 2006, 05:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.