Results 1 to 5 of 5

Thread: Crash on call to QInputDialog::getText -- in 4.7.1, new behavior since 2009.05

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Crash on call to QInputDialog::getText -- in 4.7.1, new behavior since 2009.05

    Some more interesting information...

    My function call is in a slot that is called in response to a drag-and-drop event. If I call the slot from the constructor function (i.e., after everything is initialized), it doesn't crash.

    I can also call getText one time from the slot when the slot is triggered by a signal. In the code block below, the program crashes on the second call to getText. I've got the debug lines in there to check if something is happening to the this pointer. In both cases it prints the appropriate window name.

    Qt Code:
    1. bool ok;
    2. qDebug() << "Check this:" << this->windowTitle();
    3. QInputDialog::getText(this, tr("Enter a new label"),
    4. tr("Enter a new label"), QLineEdit::Normal,
    5. "test", &ok);
    6. qDebug() << "Check this:" << this->windowTitle();
    7. QInputDialog::getText(this, tr("Enter a new label"),
    8. tr("Enter a new label"), QLineEdit::Normal,
    9. "test", &ok);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2010
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Crash on call to QInputDialog::getText -- in 4.7.1, new behavior since 2009.05

    Well, just to finish off the thread, I was never able to figure this out. I'm just using Qt 4.6 for this project.

  3. #3
    Join Date
    Nov 2010
    Posts
    315
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanked 53 Times in 51 Posts

    Default Re: Crash on call to QInputDialog::getText -- in 4.7.1, new behavior since 2009.05

    I think that problem is in some unfinished job in event loop you are in.
    Note that QInputDialog::getText creates new event loop and probably some new event requires to end handling of previous event (drag and drop events probably).
    So IMHO you should try one of two solutions:
    1. connect this slot with: Qt::ConnectionType = Qt::QueuedConnection (fifth parameter of connect with default value Qt::AutoConnection).
    2. emit signal in last possible moment (when everything is completed in handling drag and drop event).

Similar Threads

  1. Replies: 4
    Last Post: 28th August 2010, 05:42
  2. QInputDialog::getText - showing twice
    By TorAn in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2009, 01:57
  3. error from Qt version 2009.01 to 2009.02
    By cydside in forum Qt Programming
    Replies: 4
    Last Post: 9th June 2009, 22:56
  4. Replies: 8
    Last Post: 27th April 2009, 19:19
  5. Replies: 10
    Last Post: 13th September 2008, 02:39

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.