[PATCH spice-server 1/2] inputs-channel: Encapsulate SpiceTabletState

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/inputs-channel.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index ac598424..464ac21e 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -100,9 +100,16 @@ struct SpiceTabletState {
     RedsState *reds;
 };
 
-static SpiceTabletState* spice_tablet_state_new(void)
+static SpiceTabletState* spice_tablet_state_new(RedsState* reds)
 {
-    return g_new0(SpiceTabletState, 1);
+    SpiceTabletState *st = g_new0(SpiceTabletState, 1);
+    st->reds = reds;
+    return st;
+}
+
+static void spice_tablet_state_free(SpiceTabletState* st)
+{
+    g_free(st);
 }
 
 RedsState* spice_tablet_state_get_server(SpiceTabletState *st)
@@ -640,8 +647,7 @@ int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet
         return -1;
     }
     inputs->tablet = tablet;
-    inputs->tablet->st = spice_tablet_state_new();
-    inputs->tablet->st->reds = red_channel_get_server(RED_CHANNEL(inputs));
+    inputs->tablet->st = spice_tablet_state_new(red_channel_get_server(RED_CHANNEL(inputs)));
     return 0;
 }
 
@@ -654,7 +660,7 @@ void inputs_channel_detach_tablet(InputsChannel *inputs, SpiceTabletInstance *ta
 {
     spice_printerr("");
     if (tablet != NULL && tablet == inputs->tablet) {
-        g_free(tablet->st);
+        spice_tablet_state_free(tablet->st);
         tablet->st = NULL;
     }
     inputs->tablet = NULL;
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]