Results 1 to 2 of 2

Thread: Why can I get QT Libraries to throw ASSERT errors

  1. #1
    Join Date
    May 2010
    Posts
    30
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Why can I get QT Libraries to throw ASSERT errors

    I have a bug that surfaces about once a day. This bug causes my application output to show the following:

    ASSERT: "unindexedItems.isEmpty()" in file graphicsview\qgraphicsscenebsptreeindex.cpp, line 385
    QWidget::repaint: Recursive repaint detected

    I get no stack trace, and it is virtually impossible for me to recreate the error on purpose. I have found that I can set a breakpoint on qFatal() and will get access to the runtime stack that way before the application crashes, but it was my understanding that good programming practice was to put asserts only in places where you have control over input, and use them as a check to make sure that your input is good, while exceptions are more appropriate for libraries, because they are easier to handle without a disgraceful shutdown of the application.

    Can anyone shed some light on either how I can more easily track down my bug, or why QT was designed with asserts, rather than exceptions?

    Regards!

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Why can I get QT Libraries to throw ASSERT errors

    If they're using the normal C ASSERT macro, you can define NDEBUG during compilation to eliminate the call to exit, which will likely lead to some other error that might get caught by the debugger. It's odd, though, that the debugger doesn't produce a stack trace, since ASSERT normally exits with status -1.

    Otherwise, check your paint, repaint, update and associated drawing calls to make sure there's nothing suspicious going on there. There are warnings in the Qt documentation about potential recursive paint calls when some functions are used improperly.

Similar Threads

  1. Compiling errors - can't find the libraries
    By magelet in forum Newbie
    Replies: 7
    Last Post: 24th May 2010, 08:24
  2. Replies: 1
    Last Post: 15th April 2010, 19:05
  3. [QWeb] Auto fills forms and browse throw web pages?
    By flamaros in forum Qt Programming
    Replies: 0
    Last Post: 16th December 2009, 00:36
  4. Send a Image throw a QDataStream
    By gt.beta2 in forum Newbie
    Replies: 5
    Last Post: 20th March 2009, 23:07
  5. Link errors when linking chained libraries on windows
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 26th May 2008, 14:52

Tags for this Thread

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.