Skip to content
Snippets Groups Projects
Commit d44c8318 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

COMP: use automatic cleanup for run-time compat table (fixes #2314)

- occurs with newer gcc on ubuntu impish (gcc-11.2.0), but may perhaps
  actually be related to `-flto=auto` or to the destruction order of
  the static variables (race condition?).

  Leaving the compat table around for automatic cleanup does not
  impact on other lookups (which are nullptr checked anyhow).
parent 91b55257
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -37,8 +37,8 @@ Description ...@@ -37,8 +37,8 @@ Description
#include "token.H" #include "token.H"
#ifndef runTimeSelectionTables_H #ifndef Foam_runTimeSelectionTables_H
#define runTimeSelectionTables_H #define Foam_runTimeSelectionTables_H
#include <memory> // For std::unique_ptr #include <memory> // For std::unique_ptr
#include <utility> // For std::pair #include <utility> // For std::pair
...@@ -89,6 +89,7 @@ Description ...@@ -89,6 +89,7 @@ Description
// Not used directly: storage and helper methods for runtime tables // Not used directly: storage and helper methods for runtime tables
// - uses automatic cleanup for compat table (issue #2314)
#define defineRunTimeSelectionTableBase(baseType,prefix,Tspecialize) \ #define defineRunTimeSelectionTableBase(baseType,prefix,Tspecialize) \
\ \
/* Define table singleton (storage) */ \ /* Define table singleton (storage) */ \
...@@ -124,8 +125,6 @@ Description ...@@ -124,8 +125,6 @@ Description
{ \ { \
delete prefix##TablePtr_; \ delete prefix##TablePtr_; \
prefix##TablePtr_ = nullptr; \ prefix##TablePtr_ = nullptr; \
prefix##CompatTablePtr_.reset(nullptr); \
constructed = false; \
} \ } \
} \ } \
\ \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment