File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -378,12 +378,7 @@ set(_Ruby_POSSIBLE_LIB_NAMES
378
378
)
379
379
380
380
if (WIN32 OR MSYS )
381
- if (WIN32 )
382
- set (_Ruby_POSSIBLE_RUNTIMES "vcruntime140;vcruntime140_1;msvcr${MSVC_TOOLSET_VERSION} " )
383
- else ()
384
- set (_Ruby_POSSIBLE_RUNTIMES "ucrt;msvcrt" )
385
- endif ()
386
-
381
+ set (_Ruby_POSSIBLE_RUNTIMES "ucrt;msvcrt;vcruntime140;vcruntime140_1;msvcr${MSVC_TOOLSET_VERSION} " )
387
382
set (_Ruby_POSSIBLE_VERSION_SUFFIXES "${_Ruby_VERSION_NODOT} ;${_Ruby_VERSION_NODOT_ZERO_PATCH} " )
388
383
# Under MSYS CMAKE_SIZEOF_VOID_P is unset so add prefixes for 32 and 64 architectures
389
384
set (_Ruby_POSSIBLE_ARCH_PREFIXES "lib;libx64-;x64-" )
Original file line number Diff line number Diff line change @@ -175,9 +175,7 @@ namespace Rice
175
175
// Typed Data support
176
176
static inline rb_data_type_t * rb_data_type_ = nullptr ;
177
177
178
- // Track unbound instances (ie, declared variables of type Data_Type<T>
179
- // before define_class is called)
180
- static inline std::set<Data_Type<T>*>unbound_instances_;
178
+ static inline std::set<Data_Type<T>*>& unbound_instances ();
181
179
};
182
180
183
181
// ! Define a new data class in the namespace given by module.
Original file line number Diff line number Diff line change @@ -59,12 +59,12 @@ namespace Rice
59
59
// Now register with the type registry
60
60
detail::Registries::instance.types .add <T>(klass_, rb_data_type_);
61
61
62
- auto iter = Data_Type<T>::unbound_instances_. begin ();
63
- while (iter != Data_Type<T>::unbound_instances_. end () )
62
+ auto instances = unbound_instances ();
63
+ for ( auto instance: instances )
64
64
{
65
- (*iter)->set_value (klass);
66
- iter = Data_Type<T>::unbound_instances_.erase (iter);
65
+ instance->set_value (klass);
67
66
}
67
+ instances.clear ();
68
68
69
69
return Data_Type<T>();
70
70
}
@@ -84,12 +84,22 @@ namespace Rice
84
84
rb_data_type_ = nullptr ;
85
85
}
86
86
87
+ // Track unbound instances (ie, declared variables of type Data_Type<T>
88
+ // before define_class is called). We can't simply use a static inline
89
+ // member because it sometimes crashes clang and gcc (msvc seems fine)
90
+ template <typename T>
91
+ inline std::set<Data_Type<T>*>& Data_Type<T>::unbound_instances()
92
+ {
93
+ static std::set<Data_Type<T>*> unbound_instances;
94
+ return unbound_instances;
95
+ }
96
+
87
97
template <typename T>
88
98
inline Data_Type<T>::Data_Type() : Class(klass_ == Qnil ? rb_cObject : klass_)
89
99
{
90
100
if (!is_bound ())
91
101
{
92
- this -> unbound_instances_ .insert (this );
102
+ unbound_instances () .insert (this );
93
103
}
94
104
}
95
105
You can’t perform that action at this time.
0 commit comments