Results 1 to 7 of 7

Thread: QMessageBox memory problem

  1. #1
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default QMessageBox memory problem

    Hi guys

    Have been using this code with no problem up until now.
    Now its suddenly started crashing when it gets to aMB.exec();
    with memory bad access.
    Signal name :
    EXC_BAD_ACCESS

    Has anyone got any ideas what might be happening.
    I have cleaned and rebuilt and even turned the machine off and back on again.
    Am using Mac OS X Lion.

    Thanks.
    Jeff

    Qt Code:
    1. void JB_Utilities::debugMB(const QString &text,
    2. QWidget* parent,
    3. Qt::WindowModality aWindowModality)
    4. {
    5. cout << "ERROR: " << qPrintable(text) << endl;
    6. QMessageBox aMB(QMessageBox::Warning,
    7. "ERROR",
    8. text,
    9. parent);
    10. aMB.setWindowModality(aWindowModality);
    11. aMB.setDefaultButton(QMessageBox::Ok);
    12. aMB.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    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: QMessageBox memory problem

    Check that parent is a valid pointer or null/zero.

  3. #3
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QMessageBox memory problem

    @Chris

    I'm definitely passing zero into the method for the parent.

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMessageBox memory problem

    presumably this is with debug build? what is the call stack? do you have multiple qt installs?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  5. #5
    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: QMessageBox memory problem

    Does the problem persist after a clean and full rebuild?

  6. #6
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QMessageBox memory problem

    Yes it continued after a complete clean and rebuild.
    Its being called from another method of JB_Utilities.

    When called from an entirely different object, it has no problems.

    The call stack shows it getting to .exec and then crashing.
    There is only one qt install.

    The code is simply there to tell me when there is a problem.
    In this case I can get around it by making sure the code that calls it never gets executed (which is the way it should be).
    But I still hate not knowing what is going on.

    Cheers
    Jeff

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QMessageBox memory problem

    May be this article helps: http://blogs.kde.org/node/3919.

Similar Threads

  1. QMessageBox setStyleSheet UI problem
    By alexandersv in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2010, 20:35
  2. QMessageBox & QCheckBox problem
    By THRESHE in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2010, 10:23
  3. QMessageBox problem
    By flizsk in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2010, 12:52
  4. QFileDialog/ QMessageBox's Button Translation problem
    By santosh.kumar in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2009, 07:07
  5. QMessageBox problem in Qtopia
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th February 2008, 09:22

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.