Results 1 to 3 of 3

Thread: program crashes when more than 10 million signal emitted

  1. #1
    Join Date
    Nov 2011
    Location
    Karlsruhe, Germany
    Posts
    57
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default program crashes when more than 10 million signal emitted

    I have no idea what is the problem. The code is below:

    ps: the way Qt:irectConnection is no problem.

    Qt Code:
    1. loop.connect(this, SIGNAL(postData(int)), this, SLOT(getData(int)), Qt::QueuedConnection);
    2.  
    3. for (int i = 0; i < TEN_MILLION; i++) {
    4. emit postData(10);
    5. }
    6.  
    7. loop.exec();
    To copy to clipboard, switch view to plain text mode 

    Here in the debugger I can see mostly the program crashed when i around 5 million.

  2. #2
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: program crashes when more than 10 million signal emitted

    the same problem happn with me., but still don't know what exact the problem is. it might be the item internall call update() function.
    if i call signals million times even ten million times without doing any GUI changes. just print the qDebug() it works fine.
    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

  3. The following user says thank you to karankumar1609 for this useful post:

    cic (15th August 2013)

  4. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: program crashes when more than 10 million signal emitted

    Because the program must keep these few million. For qued connection emit saves information about this fact and the slot is activated only by the event loop. In the case of direct connection slot is activated immediately (like normal function) and do not need to be remembered. I do not think your test was a real situation.

  5. The following user says thank you to Lesiok for this useful post:

    cic (15th August 2013)

Similar Threads

  1. Signal isn't emitted from socket
    By 8Observer8 in forum Newbie
    Replies: 3
    Last Post: 14th August 2013, 13:33
  2. Program crashes when connecting custom signal.
    By hersheyzombie in forum Qt Programming
    Replies: 5
    Last Post: 4th September 2010, 11:00
  3. signal emitted when I zoom
    By mastupristi in forum Qwt
    Replies: 1
    Last Post: 8th July 2009, 17:02
  4. Signal emitted more than once?
    By dbrmik in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2009, 12:44
  5. Program crash when a signal is emitted
    By croscato in forum Qt Programming
    Replies: 7
    Last Post: 22nd November 2008, 22:24

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.