Results 1 to 3 of 3

Thread: Program quits unexpectedly

  1. #1
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Program quits unexpectedly

    I have experience programming C++ and building GUIs with Windows Forms (Visual C++ Express). I decided to try Qt4 and I am using as tutorial the book "C++ GUI Programming with Qt 4 (2nd Edition)
    Jasmin Blanchette , Mark Summerfield." I did the examples in chapters 1 and 2 and they work fine excepting the example "Sort" about "Shape-Changing Dialogs".
    It compiles but when I run it I get an error window stating "Sort quit unexpectedly. Click Reopen to to open the application again. Click Report to see more detailed information and send a report to Apple"

    Following the program execution with the debugger I found that the statement that fails is in constructor:
    SortDialog::SortDialog(QWidget *parent) : QDialog(parent)
    {
    setupUi(this);
    secondaryGroupBox->hide();
    tertiaryGroupBox->hide();
    layout()->setSizeConstraint(QLayout::SetFixedSize);

    setColumnRange('A', 'Z');
    }

    line "layout()->setSizeConstraint(QLayout::SetFixedSize);"

    When I ask the debugger to "step into" this line a get another message stating,
    "The inferior stopped because it received a signal from the Operating System
    Signal name: EXC_BAD_ACCESS
    Signal meaning: Could not access memory"

    I am building the program with Qt Creator 2.3.1 based on Qt 4.7.6 (64 bit).
    My computer is a MacBookPro (latest edition) with OS X Lion. It has 4 MB ram. I have already tried the following without success:
    Click "Reopen" in the first error message dialog box
    Close all the applications excepting "Finder" where the application file is. This is to have as much memory as possible available to the program.
    Rebooting the computer.
    Erasing all the program code and starting from scratch.
    Commenting out the offending line (statement). In this case the program runs, loosing some functionality.

    Any ideas about solving this problems?
    Thank you
    MCFormax, 11/05/11

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Program quits unexpectedly

    a quick observation

    Make sure layout() is returning a valid layout pointer, the ui (from) might not be adding a layout to the dialog, I bet this should be the problem.

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

    MCFormax (9th November 2011)

  4. #3
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Program quits unexpectedly

    That was it. I associated a layout manager to the main program window (the window containing all the widgets) and now it works fine

    Thank you,
    MCFormax

Similar Threads

  1. Program has unexpectedly finished
    By Maluko_Da_Tola in forum Newbie
    Replies: 5
    Last Post: 1st December 2010, 09:54
  2. application never quits
    By harmodrew in forum Newbie
    Replies: 2
    Last Post: 6th August 2010, 00:56
  3. Application won't quit until event loop quits
    By caelestis in forum Qt Programming
    Replies: 6
    Last Post: 11th February 2010, 07:21
  4. Qt 4 quits application [solved]
    By osiris81 in forum Qt Programming
    Replies: 1
    Last Post: 3rd December 2008, 14:07
  5. hide() quits?
    By Morea in forum Newbie
    Replies: 13
    Last Post: 25th February 2006, 19:40

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.