Warning, /sdk/clazy/docs/checks/README-connect-3arg-lambda.md is written in an unsupported language. File is not indexed.

0001 # connect-3arg-lambda
0002 
0003 Warns when using the 3-arg `QObject::connect` that takes a lambda.
0004 The recommendation is to use the 4-arg overload, which takes a context object
0005 so that the lambda isn't executed when the context object is deleted.
0006 
0007 It's very common to use lambdas to connect signals to slots with different number
0008 of arguments. This can result in a crash if the signal is emitted after the receiver
0009 is deleted.
0010 
0011 Another reason for using a context-object is so you explicitly think about in
0012 which thread you want the slot to run in. Note that with a context-object the
0013 connection will be of type `Qt::AutoConnection` instead of `Qt::DirectConnection`,
0014 which you can control if needed, via the 5th (optional) argument.
0015 
0016 
0017 In order to reduce false-positives, it will only warn if the lambda body dereferences
0018 at least one QObject (other than the sender).
0019 
0020 It's very hard to not have any false-positives. If you find any you probably can just
0021 pass the sender again, as 3rd parameter.
0022 
0023 This will also warn if you pass a lambda to `QTimer::singleShot()` without
0024 using the overload that takes a context object.