[retro-gtk/gtk-cleanup: 1/10] core: Fix a reference leak
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/gtk-cleanup: 1/10] core: Fix a reference leak
- Date: Sun, 24 May 2020 12:39:43 +0000 (UTC)
commit b323cc77f053d99029c6e8435ea0836225c98967
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun May 24 13:36:39 2020 +0200
core: Fix a reference leak
In 4b418a187df02897b0f6570888bf2cb5571500fc, g_set_object() was used to
simplify some code. This is wrong because it takes a reference on the
newer object, which the older code didn't do because it didn't need to.
The extra reference wasn't removed, leading to a leak.
This reverts that piece of code to what it was before the erroneous code
cleanup.
retro-runner/retro-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/retro-runner/retro-core.c b/retro-runner/retro-core.c
index 76e32ff..60ceb7c 100644
--- a/retro-runner/retro-core.c
+++ b/retro-runner/retro-core.c
@@ -1381,7 +1381,10 @@ retro_core_set_default_controller (RetroCore *self,
{
g_return_if_fail (RETRO_IS_CORE (self));
- g_set_object (&self->default_controller, retro_controller_state_new (fd));
+ if (self->default_controller)
+ g_object_unref (self->default_controller);
+
+ self->default_controller = retro_controller_state_new (fd);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]