[Development] Should QFileSystemWatcher be thread-safe? (Qt 5.8.0)

Sergio Martins sergio.martins at kdab.com
Mon Oct 2 12:12:35 CEST 2017

On 2017-09-30 13:54, René J. V.  Bertin wrote:

>> Apart from this I'd suspect you will still get the SEGV if you do not 
>> block
>> - even if the frequency changes. This points to you using some kind of
>> pointer that is not properly controlled (e.g. sending a signal to a 
>> that is already deleted).
> I think it was false alarm. I used a lambda expression as slot and must 
> have
> misunderstood why the other lambdas in the same function can use '[&]' 
> without
> ending up with invalid references in the body. I only need the watcher
> instance,
> so I'm just passing the reference to it explicitly. No more crashing 
> and less
> ambiguous anyway :)

You were probably capturing a local variable by reference inside the 
lambda, which then went out of scope.

for how to catch it at compile time.

Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts

More information about the Development mailing list