[PATCH 02/30] Move dcc glz field initialization into dcc_new

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

 



There is no reason to initialize these fields in two different places.
Note that an usage between dcc_new and the function where these
field were initialised would have resulted in a crash.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/dcc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index 336bae0..a88f8e6 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -392,6 +392,10 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
 
     dcc_init_stream_agents(dcc);
 
+    ring_init(&dcc->glz_drawables);
+    ring_init(&dcc->glz_drawables_inst_to_free);
+    pthread_mutex_init(&dcc->glz_drawables_inst_to_free_lock, NULL);
+
     dcc_encoders_init(dcc);
 
     return dcc;
@@ -1371,9 +1375,6 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
     spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
 
     spice_return_val_if_fail(!dcc->glz_dict, FALSE);
-    ring_init(&dcc->glz_drawables);
-    ring_init(&dcc->glz_drawables_inst_to_free);
-    pthread_mutex_init(&dcc->glz_drawables_inst_to_free_lock, NULL);
     dcc->glz_dict = dcc_get_glz_dictionary(dcc,
                                            init->glz_dictionary_id,
                                            init->glz_dictionary_window_size);
@@ -1479,9 +1480,6 @@ static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
 {
     spice_return_val_if_fail(!dcc->glz_dict, FALSE);
 
-    ring_init(&dcc->glz_drawables);
-    ring_init(&dcc->glz_drawables_inst_to_free);
-    pthread_mutex_init(&dcc->glz_drawables_inst_to_free_lock, NULL);
     dcc->glz_dict = dcc_restore_glz_dictionary(dcc,
                                                migrate->glz_dict_id,
                                                &migrate->glz_dict_data);
-- 
2.7.4

_______________________________________________
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]