Results 1 to 4 of 4

Thread: Debugging start up

  1. #1
    Join Date
    Jun 2010
    Posts
    26
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Debugging start up

    Hi

    I'm having trouble debugging the processes after the end of construction but presumably before the first resizeEvent. During that time something goes awry and causes a crash. Due to the fact that we are in the event loop (or maybe not) I don't know how I can find out what causes the problem.

    I have a QMainWindow and set up the menus, toolbar, main widgets etc in the constructor. However, this was taking too long to finish so I wanted to change to doing basic start up in the constructor and call a second initialisation function via a single shot timer, as suggested here:
    http://doc.qt.nokia.com/qtopia2.2/html/quicklaunch.html
    so that the main window could open and show a "Please wait" message while the second function finishes loading data etc.

    The problem is that after I shift code into the second function then the program crashes some time after calling the single shot timer. As far as I can tell, the constructor exits; the destructor is not called. I would expect resizeEvent would be called as one of the first things in the event loop but it doesn't seem to be. I can't see anything in my constructor that isn't initialised enough so that it would cause the event loop to die (if it actually started).

    My program is on a Zaurus running QPE+Qtopia 1.5 with QT/embedded 2.3 so debugging in situ is very difficult. I run it under QT 3 on a Linux desktop but in that environment there are no problems. Another thing is running in portrait or landscape mode on the Zaurus, it should only mean different parameters to resizeEvent but it seems more likely to fail in portrait mode.

    Sorry if this explanation doesn't sound clear, I have experimented with various different amounts of start up code in the constructor and am really having trouble forming a logical description of the problem, hence I need help in formulating strategies to debug. So far I have been writing a logfile and output to stderr.

    My code is

    Qt Code:
    1. QPEApplication app(argc, argv);
    2. app.showMainWidget(&myMainWindow);
    3. return(app.exec());
    4.  
    5. ...
    6.  
    7. myMainWindow::myMainWindow() : QMainWindow()
    8. {
    9. // basic set up
    10. ...
    11.  
    12. QTimer::singleShot(0, this, SLOT(initialise()));
    13. }
    To copy to clipboard, switch view to plain text mode 

    Many thanks in advance.

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

    Default Re: Debugging start up

    Can you post the complete constructor code and initialise() code please?

  3. #3
    Join Date
    Jun 2010
    Posts
    26
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Debugging start up

    As I said, the constructor initialises a few member variables before calling the single shot timer. The initialise function is much longer, setting up menu, toolbar, all the mainwindow widgets plus other things.

    Previously I had constructor(){ A,B,C,D } but now I have constructor(){ A,singleshot }; initialise() { B,C,D }. So the problem is something happening between the constructor and initialise, i.e. in the event loop.

    Apart from setting up timing and drawing widgets, what else is QT doing ? How can I debug to find out what is going wrong ?

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

    Default Re: Debugging start up

    Can you post the complete constructor code and initialise() code please?
    I don't know how you can debug on embedded machines, I have no experience with that. But I might be able to point out problems in your code, if you post it.

Similar Threads

  1. SXE key has not been set when debugging
    By learning_qt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th September 2008, 09:59
  2. Debugging with gdb
    By SteM in forum Newbie
    Replies: 4
    Last Post: 9th August 2007, 15:40
  3. Debugging
    By Voldemort in forum Qt Programming
    Replies: 13
    Last Post: 14th May 2007, 21:38
  4. Debugging on Mac
    By rickbsgu in forum Qt Programming
    Replies: 3
    Last Post: 13th October 2006, 14:12
  5. Qt debugging
    By Morea in forum Newbie
    Replies: 4
    Last Post: 24th March 2006, 19:28

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
  •  
Qt is a trademark of The Qt Company.