示例#1
0
文件: gd_mono.cpp 项目: torugok/godot
void _GodotSharp::queue_dispose(RID *p_rid) {

	if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
		memdelete(p_rid);
	} else {
#ifndef NO_THREADS
		queue_mutex->lock();
#endif

		ENQUEUE_FOR_DISPOSAL(rid_delete_queue, p_rid);

#ifndef NO_THREADS
		queue_mutex->unlock();
#endif
	}
}
示例#2
0
void _GodotSharp::queue_dispose(NodePath *p_node_path) {

	if (GDMonoUtils::is_main_thread() && !is_domain_finalizing_for_unload(SCRIPTS_DOMAIN)) {
		memdelete(p_node_path);
	} else {
#ifndef NO_THREADS
		queue_mutex->lock();
#endif

		ENQUEUE_FOR_DISPOSAL(np_delete_queue, p_node_path);

#ifndef NO_THREADS
		queue_mutex->unlock();
#endif
	}
}
示例#3
0
文件: gd_mono.cpp 项目: torugok/godot
void _GodotSharp::queue_dispose(MonoObject *p_mono_object, Object *p_object) {

	if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) {
		_dispose_object(p_object);
	} else {
#ifndef NO_THREADS
		queue_mutex->lock();
#endif

		// This is our last chance to invoke notification predelete (this is being called from the finalizer)
		// We must use the MonoObject* passed by the finalizer, because the weak GC handle target returns NULL at this point
		CSharpInstance *si = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
		if (si) {
			si->call_notification_no_check(p_mono_object, Object::NOTIFICATION_PREDELETE);
		}

		ENQUEUE_FOR_DISPOSAL(obj_delete_queue, p_object);

#ifndef NO_THREADS
		queue_mutex->unlock();
#endif
	}
}