Bug 403578 - Add warnings for QDialog::exec and similar pseudo-synchronous methods
Summary: Add warnings for QDialog::exec and similar pseudo-synchronous methods
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-25 01:51 UTC by smokris
Modified: 2019-01-25 01:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description smokris 2019-01-25 01:51:47 UTC
The documentation for QDialog::exec (http://doc.qt.io/qt-5/qdialog.html#exec) says:

> Note: Avoid using this function; instead, use open(). Unlike exec(), open()
> is asynchronous, and does not spin an additional event loop. This prevents a
> series of dangerous bugs from happening (e.g. deleting the dialog's parent
> while the dialog is open via exec()). 

There's some more explanation at https://blog.qt.io/blog/2010/02/23/unpredictable-exec/ .  Also, https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0 says that these methods should be avoided:

> QCoreApplication::processEvents
> QDialog::exec
> QDrag::exec
> QEventLoop::processEvents
> QProcess::waitForStarted
> QProcess::waitForFinished

It would be handy to have clazy emit warnings for calls to these methods.