diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-08-23 15:10:03 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-10-28 15:47:14 +0900 |
commit | 9d2400af8bfedbd74954d185ef1c24190798bb8e (patch) | |
tree | 799fcdf9ddebe373cd316cc06872ba2cff4e7fb0 /src/lib/evas/cserve2/evas_cs2_client.c | |
parent | a14e69e5733457f2b8e09caadb24271522cbe82b (diff) |
evas/cserve2: Add valid flag on Image_Data and File_Data
Images and Files can be discovered by the client scanner before they
are valid (aka. loaded or opened). We want clients to ignore all
shared objects that are not ready yet, as they are in an undefined
state (values and memory might be invalid).
Diffstat (limited to '')
-rw-r--r-- | src/lib/evas/cserve2/evas_cs2_client.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c index 7746e1d1c0..b378b7914a 100644 --- a/src/lib/evas/cserve2/evas_cs2_client.c +++ b/src/lib/evas/cserve2/evas_cs2_client.c | |||
@@ -440,6 +440,10 @@ _image_opened_cb(void *data, const void *msg_received, int size) | |||
440 | * -- jpeg | 440 | * -- jpeg |
441 | */ | 441 | */ |
442 | //DBG("Received OPENED for RID: %d [open_rid: %d]", answer->rid, ie->open_rid); | 442 | //DBG("Received OPENED for RID: %d [open_rid: %d]", answer->rid, ie->open_rid); |
443 | |||
444 | if (ie->server_id && !ie->open_rid) | ||
445 | return; | ||
446 | |||
443 | if (answer->rid != ie->open_rid) | 447 | if (answer->rid != ie->open_rid) |
444 | { | 448 | { |
445 | WRN("Message rid (%d) differs from expected rid (open_rid: %d)", answer->rid, ie->open_rid); | 449 | WRN("Message rid (%d) differs from expected rid (open_rid: %d)", answer->rid, ie->open_rid); |
@@ -536,6 +540,10 @@ _image_loaded_cb(void *data, const void *msg_received, int size) | |||
536 | Image_Entry *ie = data; | 540 | Image_Entry *ie = data; |
537 | 541 | ||
538 | //DBG("Received LOADED for RID: %d [load_rid: %d]", answer->rid, ie->load_rid); | 542 | //DBG("Received LOADED for RID: %d [load_rid: %d]", answer->rid, ie->load_rid); |
543 | |||
544 | if (!ie->load_rid) | ||
545 | return; | ||
546 | |||
539 | if (answer->rid != ie->load_rid) | 547 | if (answer->rid != ie->load_rid) |
540 | { | 548 | { |
541 | WRN("Message rid (%d) differs from expected rid (load_rid: %d)", answer->rid, ie->load_rid); | 549 | WRN("Message rid (%d) differs from expected rid (load_rid: %d)", answer->rid, ie->load_rid); |
@@ -926,7 +934,7 @@ evas_cserve2_image_load_wait(Image_Entry *ie) | |||
926 | 934 | ||
927 | #if USE_SHARED_INDEX | 935 | #if USE_SHARED_INDEX |
928 | fd = _shared_image_entry_file_data_find(ie); | 936 | fd = _shared_image_entry_file_data_find(ie); |
929 | if (fd) | 937 | if (fd && fd->valid) |
930 | { | 938 | { |
931 | INF("Bypassing socket wait (open_rid %d)", ie->open_rid); | 939 | INF("Bypassing socket wait (open_rid %d)", ie->open_rid); |
932 | ie->w = fd->w; | 940 | ie->w = fd->w; |
@@ -935,6 +943,7 @@ evas_cserve2_image_load_wait(Image_Entry *ie) | |||
935 | ie->animated.loop_hint = fd->loop_hint; | 943 | ie->animated.loop_hint = fd->loop_hint; |
936 | ie->animated.loop_count = fd->loop_count; | 944 | ie->animated.loop_count = fd->loop_count; |
937 | ie->animated.frame_count = fd->frame_count; | 945 | ie->animated.frame_count = fd->frame_count; |
946 | ie->server_id = fd->id; | ||
938 | ie->open_rid = 0; | 947 | ie->open_rid = 0; |
939 | return CSERVE2_NONE; | 948 | return CSERVE2_NONE; |
940 | } | 949 | } |
@@ -981,7 +990,7 @@ evas_cserve2_image_load_data_wait(Image_Entry *ie) | |||
981 | 990 | ||
982 | #if USE_SHARED_INDEX | 991 | #if USE_SHARED_INDEX |
983 | idata = _shared_image_entry_image_data_find(ie); | 992 | idata = _shared_image_entry_image_data_find(ie); |
984 | if (idata) | 993 | if (idata && idata->valid) |
985 | { | 994 | { |
986 | // FIXME: Ugly copy & paste from _loaded_handle | 995 | // FIXME: Ugly copy & paste from _loaded_handle |
987 | Data_Entry *dentry = ie->data2; | 996 | Data_Entry *dentry = ie->data2; |
@@ -2196,7 +2205,7 @@ _shared_image_entry_image_data_find(Image_Entry *ie) | |||
2196 | eina_hash_find(_index.images.entries_by_hkey, ie->cache_key); | 2205 | eina_hash_find(_index.images.entries_by_hkey, ie->cache_key); |
2197 | if (idata) | 2206 | if (idata) |
2198 | { | 2207 | { |
2199 | ERR("Image found in shared index (by cache_key)."); | 2208 | DBG("Image found in shared index (by cache_key)."); |
2200 | goto found; | 2209 | goto found; |
2201 | } | 2210 | } |
2202 | 2211 | ||
@@ -2254,6 +2263,12 @@ _shared_image_entry_image_data_find(Image_Entry *ie) | |||
2254 | return NULL; | 2263 | return NULL; |
2255 | 2264 | ||
2256 | found: | 2265 | found: |
2266 | if (!idata->valid) | ||
2267 | { | ||
2268 | DBG("Found image but it is not ready yet: %d", idata->id); | ||
2269 | return NULL; | ||
2270 | } | ||
2271 | |||
2257 | shmpath = _shared_string_get(idata->shm_id); | 2272 | shmpath = _shared_string_get(idata->shm_id); |
2258 | if (!shmpath) | 2273 | if (!shmpath) |
2259 | { | 2274 | { |