swq_op_registrar class is not thread-safe
|Reported by:||Even Rouault||Owned by:||warmerdam|
The following sequence in swq_op_registrar::GetOperator?() that is not protected by a mutex cause thread-safety issue.
if( !papoOperations ) Initialize();
The issue is that Initialize() can set a non-NULL papoOperations pointer while it is partially initialized.
Issue discovered with the enhancement of test_ogrsf to test thread-safety of OGR drivers that can be frequently reproduced
Two possible ways of fixing this :
- removing the test in the above snippet.
- or making Initialize() smarter to only set papoOperations when it is fully initialized. The difficulty here is to have the guarantee of a full memory barrier to avoid early assignement visibility.
Going for the easy and safe way...