[Interest] QProgressDialog when setValue(0) is called

igor.mironchik at gmail.com igor.mironchik at gmail.com
Wed Dec 28 14:54:04 CET 2016


Have you tried to set this connection:

QObject::connect(transientAnimation, SIGNAL(progress(int)), &progress,
SLOT(setValue(int)));

as queued directly?

Best regards,
Igor Mironchik.

From: Berkay Elbir
Sent: 28 декабря 2016 г. 16:19
To: interest at qt-project.org Interest; development at qt-project.org
Subject: [Interest] QProgressDialog when setValue(0) is called

Hello All,

I have a class that is inherited from QProgressDialog. It sometimes
crashes and its inside QProgressDialog class code.

I detected that when the setValue(0); is called in its constructor,
crash happens. When I commented out this function, It does not crash.
Even if setValue(0) is called after constructing of object crash still
occurs.

This crash occurs when signals are emitted faster. Code piece shows
how the function is called:

ProgressDialog progress(nullptr);
progress.setLabelText("Loading Result Files");
QFutureWatcher<void> watcher;
QFuture<void> future = QtConcurrent::run(myClassPtr,&myClass::myFunc);

QEventLoop loop;
QObject::connect(&watcher, SIGNAL(started()), &progress, SLOT(show()));
QObject::connect(&watcher, SIGNAL(finished()), &progress, SLOT(hide()));
QObject::connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit()));
QObject::connect(transientAnimation, SIGNAL(progress(int)), &progress,
SLOT(setValue(int)));

watcher.setFuture(future);

loop.exec();

progress signal is emitted inside myFunc() in another thread. In this
function, multiple files are read in a folder and progress signal is
emitted.

Why does this crash occur?

Thanks in advance.

Berkay
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161228/27a295b5/attachment.html>


More information about the Interest mailing list