Bug 389057

Summary: warn about QTimer::singleShot(0) performance
Product: [Developer tools] clazy Reporter: Milian Wolff <mail>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED UPSTREAM    
Severity: wishlist CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Milian Wolff 2018-01-16 14:23:47 UTC
See also:

https://codereview.qt-project.org/#/c/216497/

Generally, it should be warned to not use QTimer::singleShot(0, Functor), as that cannot be optimized easily. It should instead use QTimer::singleShot(0, ctx, Functor);
Comment 1 Sergio Martins 2018-02-10 21:24:04 UTC
Is this still relevant with all your patches ?
Comment 2 Milian Wolff 2018-02-14 10:00:24 UTC
no, once the patches get in we can ignore this. Does clazy know about the used Qt version? If so, it could warn about this in older Qt versions. Low-prio of course
Comment 3 Sergio Martins 2019-02-15 19:26:40 UTC
Let's tackle this in Qt instead.

And anyway clazy already warns if you don't pass a context object, as that can bring threading bugs or crashes. Also, the general feeling is to deprecate the connect() taking only 3 args, and forcing people to use context obj, even with lambdas/functor.