Godot version
4.7-stable
godot-cpp version
ba0edfe
System information
Windows 10, i7-8750h
Issue description
Macros "_THREAD_SAFE_XXX" in " include/godot_cpp/core/mutex_lock.hpp" use godot::Mutex without memnew() or Ref<T>, it will lead to the crash CRASH_NOW_MSG("BUG: Godot Object created without binding callbacks. Did you forget to use memnew()?");
It seems that "include/godot_cpp/core/mutex_lock.hpp" is simply migrated from godot source, we should do some change by using std::mutex or godot::Ref<godot::Mutex>, or consider the possibility of using some godot object without memnew().
Steps to reproduce
Just use _THREAD_SAFE_CLASS_ in any class and try to instantiate it.
// register_types.cpp
...
#include <godot_cpp/core/mutex_lock.hpp>
class MutexTest {
_THREAD_SAFE_CLASS_
public:
void test() {
...
}
};
...
void initialize_gdextension_types(ModuleInitializationLevel p_level)
{
MutexTest test; // Crash
...
}
Minimal reproduction project
N/A
Godot version
4.7-stable
godot-cpp version
ba0edfe
System information
Windows 10, i7-8750h
Issue description
Macros "_THREAD_SAFE_XXX" in " include/godot_cpp/core/mutex_lock.hpp" use
godot::Mutexwithoutmemnew()orRef<T>, it will lead to the crash CRASH_NOW_MSG("BUG: Godot Object created without binding callbacks. Did you forget to use memnew()?");It seems that "include/godot_cpp/core/mutex_lock.hpp" is simply migrated from godot source, we should do some change by using
std::mutexorgodot::Ref<godot::Mutex>, or consider the possibility of using some godot object withoutmemnew().Steps to reproduce
Just use
_THREAD_SAFE_CLASS_in any class and try to instantiate it.Minimal reproduction project
N/A