PDA

View Full Version : The GUI is hang



ugiwgh
5th November 2014, 03:36
My program's GUI is hang(The gui is not start). I attachd it process(gdb -p pid).

The following is backtrace.


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



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

Any help will be appreciated.

wysota
5th November 2014, 08:04
Show your main() please.

ugiwgh
5th November 2014, 09:31
The following is my main code.




int main(int argc,char **argv)
{
qDebug()<<"Main Begin";
QApplication app(argc,argv);

MCanvas *canvas=new MCanvas;
MRender *render=new MRender;
MZoom *zoom=new MZoom;
//if(NULL==zoom)qDebug()<<"zomm is null";
//QObject::connect(render,SIGNAL(rendered(const QImage &)),canvas,SLOT(updateImage(const QImage &)));
QObject::connect(render,SIGNAL(rendered(const QImage &)),canvas,SLOT(updateImage(const QImage &)),Qt::DirectConnection); // This is the hang line
render->start();
zoom->start();

QWidget *widget=new QWidget;
widget->resize(800,600);
QGridLayout *layout=new QGridLayout(widget);
layout->addWidget(canvas);
layout->setContentsMargins(0,0,0,0);
widget->setLayout(layout);
widget->show();

app.exec();
delete render;
delete widget;
qDebug()<<"Main End";

return 0;
}

anda_skoa
5th November 2014, 10:42
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,
_

ugiwgh
6th November 2014, 02:02
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.

wysota
6th November 2014, 10:27
Please prepare a minimal compilable example reproducing the problem.

ugiwgh
7th November 2014, 11:04
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.