[Spice-devel] [PATCH v4 12/19] Better encoders encapsulation

Frediano Ziglio fziglio at redhat.com
Tue Jun 14 09:33:04 UTC 2016


Avoid to access some fields from dcc.c

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dcc-encoders.c | 4 ++++
 server/dcc.c          | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 3547adc..22cfcf3 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -710,6 +710,8 @@ gboolean image_encoders_get_glz_dictionary(ImageEncoders *enc,
 {
     GlzSharedDictionary *shared_dict;
 
+    spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
     pthread_mutex_lock(&glz_dictionary_list_lock);
 
     shared_dict = find_glz_dictionary(client, id);
@@ -743,6 +745,8 @@ gboolean image_encoders_restore_glz_dictionary(ImageEncoders *enc,
 {
     GlzSharedDictionary *shared_dict = NULL;
 
+    spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
     pthread_mutex_lock(&glz_dictionary_list_lock);
 
     shared_dict = find_glz_dictionary(client, id);
diff --git a/server/dcc.c b/server/dcc.c
index 3190c94..039229d 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -903,7 +903,6 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
                                          init->pixmap_cache_size);
     spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
 
-    spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
     success = image_encoders_get_glz_dictionary(&dcc->encoders,
                                                 RED_CHANNEL_CLIENT(dcc)->client,
                                                 init->glz_dictionary_id,
@@ -1008,8 +1007,6 @@ int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void
 static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
                                              SpiceMigrateDataDisplay *migrate)
 {
-    spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
-
     return image_encoders_restore_glz_dictionary(&dcc->encoders,
                                                  RED_CHANNEL_CLIENT(dcc)->client,
                                                  migrate->glz_dict_id,
-- 
2.7.4



More information about the Spice-devel mailing list