[retro-gtk] core: Port the content of the destructor to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Port the content of the destructor to C
- Date: Thu, 20 Jul 2017 12:54:08 +0000 (UTC)
commit 3f2ea86055384cba0ecdd785d584765a6354513d
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 20 11:35:43 2017 +0200
core: Port the content of the destructor to C
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 11 +++--------
retro-gtk/retro-core.c | 42 +++++++++++++++++++++++++++---------------
2 files changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index 7699583..a98f42f 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -241,15 +241,11 @@ public class Core : Object {
}
~Core () {
- push_cb_data ();
- if (game_loaded)
- module.unload_game ();
- module.deinit ();
- pop_cb_data ();
-
- environment_internal_release ();
+ destructor ();
}
+ private extern void destructor ();
+
/**
* Initializes the module.
*
@@ -323,7 +319,6 @@ public class Core : Object {
private extern void set_system_av_info (SystemAvInfo system_av_info);
private extern void environment_internal_setup ();
- private extern void environment_internal_release ();
}
}
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 3f0fc78..e661f7f 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -323,6 +323,33 @@ retro_core_load_medias (RetroCore* self,
g_free (uri);
}
+// FIXME Make static as soon as possible.
+void
+retro_core_destructor (RetroCore *self)
+{
+ RetroCoreEnvironmentInternal *internal;
+ RetroUnloadGame unload_game;
+ RetroDeinit deinit;
+
+ g_return_if_fail (self != NULL);
+
+ internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
+
+ retro_core_push_cb_data (self);
+ if (retro_core_get_game_loaded (self)) {
+ unload_game = retro_module_get_unload_game (self->module);
+ unload_game ();
+ }
+ deinit = retro_module_get_deinit (self->module);
+ deinit ();
+ retro_core_pop_cb_data ();
+
+ if (internal->media_uris != NULL)
+ g_strfreev (internal->media_uris);
+
+ g_free (self->environment_internal);
+}
+
/* Public */
void
@@ -652,18 +679,3 @@ retro_core_environment_internal_setup (RetroCore *self)
{
self->environment_internal = g_new0 (RetroCoreEnvironmentInternal, 1);
}
-
-void
-retro_core_environment_internal_release (RetroCore *self)
-{
- RetroCoreEnvironmentInternal *internal;
-
- g_return_if_fail (self != NULL);
-
- internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
-
- if (internal->media_uris != NULL)
- g_strfreev (internal->media_uris);
-
- g_free (self->environment_internal);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]