Results 1 to 7 of 7

Thread: The GUI is hang

  1. #1
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default The GUI is hang

    My program's GUI is hang(The gui is not start). I attachd it process(gdb -p pid).

    The following is backtrace.
    Qt Code:
    1. (gdb) info thread
    2. * 1 Thread 0x7f9bc495a760 (LWP 13482) 0x0000003c822f0dee in __lll_lock_wait_private ()
    3. from /lib64/libc.so.6
    4. (gdb) bt
    5. #0 0x0000003c822f0dee in __lll_lock_wait_private () from /lib64/libc.so.6
    6. #1 0x0000003c8227c138 in _L_lock_9164 () from /lib64/libc.so.6
    7. #2 0x0000003c82279a32 in malloc () from /lib64/libc.so.6
    8. #3 0x0000003c8226fcfb in __libc_message () from /lib64/libc.so.6
    9. #4 0x0000003c82275676 in malloc_printerr () from /lib64/libc.so.6
    10. #5 0x0000003c8227ab57 in _int_realloc () from /lib64/libc.so.6
    11. #6 0x0000003c8227acb5 in realloc () from /lib64/libc.so.6
    12. #7 0x00007f9bc49f449b in QListData::realloc (this=0x11f6f38, alloc=2)
    13. at /var/tmp/qt-x11-src-4.5.1/src/corelib/tools/qlistdata.cpp:111
    14. #8 0x00007f9bc49f4569 in QListData::append (this=0x11f6f38)
    15. at /var/tmp/qt-x11-src-4.5.1/src/corelib/tools/qlistdata.cpp:131
    16. #9 0x00007f9bc4ad4a5b in QList<QObjectPrivate::Connection>::append (this=0x11f6f38, t=...)
    17. at ../../include/QtCore/../../src/corelib/tools/qlist.h:426
    18. #10 0x00007f9bc4accd9c in QObjectPrivate::addConnection (this=0x11f5cc0, signal=11, c=0x7fff2cf9d2e0)
    19. at /var/tmp/qt-x11-src-4.5.1/src/corelib/kernel/qobject.cpp:277
    20. #11 0x00007f9bc4acd8c4 in QMetaObject::connect (sender=0x11f5c30, signal_index=11, receiver=
    21. 0x11f6460, method_index=29, type=1, types=0x0)
    22. at /var/tmp/qt-x11-src-4.5.1/src/corelib/kernel/qobject.cpp:2808
    23. #12 0x00007f9bc4acf8f6 in QObject::connect (sender=0x11f5c30, signal=<value optimized out>, receiver=
    24. 0x11f6460, method=<value optimized out>, type=4294966784)
    25. at /var/tmp/qt-x11-src-4.5.1/src/corelib/kernel/qobject.cpp:2545
    26. #13 0x000000000040cdde in main (argc=1, argv=0x7fff2cf9d5f8) at paramon.cpp:28
    To copy to clipboard, switch view to plain text mode 

    The main.cpp:28 is "QObject::connect(render,SIGNAL(renderedPixmap(con st QImage &)),canvas,SLOT(updatePixmap(const QImage &)),Qt:irectConnection);".

    Any help will be appreciated.
    Last edited by ugiwgh; 5th November 2014 at 07:00.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: The GUI is hang

    Show your main() please.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default Re: The GUI is hang

    The following is my main code.


    Qt Code:
    1. int main(int argc,char **argv)
    2. {
    3. qDebug()<<"Main Begin";
    4. QApplication app(argc,argv);
    5.  
    6. MCanvas *canvas=new MCanvas;
    7. MRender *render=new MRender;
    8. MZoom *zoom=new MZoom;
    9. //if(NULL==zoom)qDebug()<<"zomm is null";
    10. //QObject::connect(render,SIGNAL(rendered(const QImage &)),canvas,SLOT(updateImage(const QImage &)));
    11. QObject::connect(render,SIGNAL(rendered(const QImage &)),canvas,SLOT(updateImage(const QImage &)),Qt::DirectConnection); // This is the hang line
    12. render->start();
    13. zoom->start();
    14.  
    15. QWidget *widget=new QWidget;
    16. widget->resize(800,600);
    17. QGridLayout *layout=new QGridLayout(widget);
    18. layout->addWidget(canvas);
    19. layout->setContentsMargins(0,0,0,0);
    20. widget->setLayout(layout);
    21. widget->show();
    22.  
    23. app.exec();
    24. delete render;
    25. delete widget;
    26. qDebug()<<"Main End";
    27.  
    28. return 0;
    29. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: The GUI is hang

    As wysota already told you in the other thread (btw, thanks for duplicating the topic), you cannot create a QPixmap in any other thread then the one running the QApplication event loop (here the main thread).

    Cheers,
    _

  5. #5
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default Re: The GUI is hang

    As wysota already told you in the other thread (btw, thanks for duplicating the topic), you cannot create a QPixmap in any other thread then the one running the QApplication event loop (here the main thread).
    Thanks for your attention.
    This is the different with that thread.
    My code has been improved for many times. And some problems are resolved, some new problems come in.
    I had removed QPixmap from any other thread.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: The GUI is hang

    Please prepare a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default Re: The GUI is hang

    Sorry, it worksforme.
    It happend when I add "zoomMessage_="Who am I?";" to class MZoom constructor.
    And I don't have enough information to reproduce it now too.
    I ask redhat in the following link https://bugzilla.redhat.com/show_bug.cgi?id=1160557.

Similar Threads

  1. Every Qt app in WinXP - 'blocked' input?
    By aabbaa in forum Newbie
    Replies: 3
    Last Post: 10th November 2012, 06:58
  2. GUI application as DLL. Repaint is blocked.
    By Grinchman in forum Qt Programming
    Replies: 11
    Last Post: 8th June 2011, 07:28
  3. GUI blocked
    By Astrologer in forum Qwt
    Replies: 1
    Last Post: 24th June 2010, 14:07
  4. how blocked center in QGraphicsScene
    By estel in forum Newbie
    Replies: 3
    Last Post: 20th March 2010, 10:11
  5. GUI thread blocked using QThread.
    By summer_of_69 in forum Qt Programming
    Replies: 11
    Last Post: 18th May 2009, 09:43

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.