Example #1
0
ClrFuncInvokeContext::~ClrFuncInvokeContext()
{
    if (this->callback)
    {
        DBG("ClrFuncInvokeContext::DisposeCallback");
        this->callback->Reset();
        delete this->callback;
        this->callback = NULL;        
    }
    mono_gchandle_free(this->_this);
}
Example #2
0
void
mono_error_cleanup (MonoError *oerror)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	short int orig_error_code = error->error_code;
	gboolean free_strings = error->flags & MONO_ERROR_FREE_STRINGS;
	gboolean has_instance_handle = is_managed_exception (error);

	/* Two cleanups in a row without an intervening init. */
	g_assert (orig_error_code != MONO_ERROR_CLEANUP_CALLED_SENTINEL);
	/* Mempool stored error shouldn't be cleaned up */
	g_assert (!is_boxed (error));

	/* Mark it as cleaned up. */
	error->error_code = MONO_ERROR_CLEANUP_CALLED_SENTINEL;
	error->flags = 0;

	if (orig_error_code == MONO_ERROR_NONE)
		return;


	if (has_instance_handle)
		mono_gchandle_free (error->exn.instance_handle);


	g_free ((char*)error->full_message);
	g_free ((char*)error->full_message_with_fields);
	error->full_message = NULL;
	error->full_message_with_fields = NULL;
	if (!free_strings) //no memory was allocated
		return;

	g_free ((char*)error->type_name);
	g_free ((char*)error->assembly_name);
	g_free ((char*)error->member_name);
	g_free ((char*)error->exception_name_space);
	g_free ((char*)error->exception_name);
	g_free ((char*)error->first_argument);
	error->type_name = error->assembly_name = error->member_name = error->exception_name_space = error->exception_name = error->first_argument = NULL;
	error->exn.klass = NULL;

}
Example #3
0
char *
mono_exception_get_native_backtrace (MonoException *exc)
{
#ifdef HAVE_BACKTRACE_SYMBOLS
	MonoDomain *domain;
	MonoArray *arr = exc->native_trace_ips;
	int i, len;
	GString *text;
	char **messages;

	if (!arr)
		return g_strdup ("");
	domain = mono_domain_get ();
	len = mono_array_length (arr);
	text = g_string_new_len (NULL, len * 20);
	uint32_t gchandle = mono_gchandle_new (&arr->obj, TRUE); /* pinned */
	void* addr = mono_array_addr (arr, gpointer, 0);
	MONO_ENTER_GC_SAFE;
	messages = backtrace_symbols (addr, len);
	MONO_EXIT_GC_SAFE;
	mono_gchandle_free (gchandle);

	for (i = 0; i < len; ++i) {
		gpointer ip = mono_array_get (arr, gpointer, i);
		MonoJitInfo *ji = mono_jit_info_table_find (mono_domain_get (), (char *)ip);
		if (ji) {
			char *msg = mono_debug_print_stack_frame (mono_jit_info_get_method (ji), (char*)ip - (char*)ji->code_start, domain);
			g_string_append_printf (text, "%s\n", msg);
			g_free (msg);
		} else {
			g_string_append_printf (text, "%s\n", messages [i]);
		}
	}

	g_free (messages);
	return g_string_free (text, FALSE);
#else
	return g_strdup ("");
#endif
}
Example #4
0
void
mono_error_cleanup (MonoError *oerror)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	if (error->error_code == MONO_ERROR_NONE)
		return;

	if (is_managed_exception (error))
		mono_gchandle_free (error->exn.instance_handle);

	g_free ((char*)error->full_message);
	g_free ((char*)error->full_message_with_fields);
	if (!(error->flags & MONO_ERROR_FREE_STRINGS)) //no memory was allocated
		return;

	g_free ((char*)error->type_name);
	g_free ((char*)error->assembly_name);
	g_free ((char*)error->member_name);
	g_free ((char*)error->exception_name_space);
	g_free ((char*)error->exception_name);
	g_free ((char*)error->first_argument);
}
Example #5
0
void
ves_icall_System_GCHandle_FreeHandle (guint32 handle)
{
	mono_gchandle_free (handle);
}
Example #6
0
DOMBase::~DOMBase()
{
	if (_JSWrapperWPtr != 0)
		mono_gchandle_free(_JSWrapperWPtr);
}