[Interest] BRe: can the QRegExpEngine cache acces objects belonging to an unloaded library during global destruction?

Thiago Macieira thiago.macieira at intel.com
Wed Jan 31 16:19:17 CET 2018


On Wednesday, 31 January 2018 07:13:53 PST René J. V. Bertin wrote:
> > You have the symptom of QBasicMutex containing garbage. It is thinking the
> > mutex is locked.
> 
> Right. Or not, and then trying to lock it upon my request. Using
> uninitialised variables is kind of UB too, no? 

Correct. You can copy uninitialised values if you use byte-level access, so 
memcpy is allowed, but you can't make decisions using them.

> > QMutex as a member variable in the class is fine too. Just don't make it
> > static.
> 
> Why would I do that? Moving the mutex into the class only makes sense if you
> want to be able to lock different instances independently; making it a
> static member wouldn't change anything w.r.t. to current code, in practice.

If you only have one instance, then having it inside the class means you still 
have only 1.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list