diff options
author | Carsten Haitzler <raster@rasterman.com> | 2011-02-27 16:21:39 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2011-02-27 16:21:39 +0000 |
commit | a19a9010dff3c5e30185f3ec234c44c55385c540 (patch) | |
tree | 5434f64c727bc1c3096b912d5fa767a1bdb637dd /legacy/emotion/src/lib/emotion_smart.c | |
parent | a457791496dccc9c818165ac6f63961eaa26fc84 (diff) |
avoid segv on file set (zero imge data)
SVN revision: 57391
Diffstat (limited to '')
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index ad141db933..395649c7e2 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -144,11 +144,17 @@ _emotion_image_data_zero(Evas_Object *img) | |||
144 | data = evas_object_image_data_get(img, 1); | 144 | data = evas_object_image_data_get(img, 1); |
145 | if (data) | 145 | if (data) |
146 | { | 146 | { |
147 | int w, h, sz; | 147 | int w, h, sz = 0; |
148 | Evas_Colorspace cs; | ||
148 | 149 | ||
149 | evas_object_image_size_get(img, &w, &h); | 150 | evas_object_image_size_get(img, &w, &h); |
150 | sz = w * h * 4; | 151 | cs = evas_object_image_colorspace_get(img); |
151 | memset(data, 0, sz); | 152 | if (cs == EVAS_COLORSPACE_ARGB8888) |
153 | sz = w * h * 4; | ||
154 | if ((cs == EVAS_COLORSPACE_YCBCR422P601_PL) || | ||
155 | (cs == EVAS_COLORSPACE_YCBCR422P709_PL)) | ||
156 | sz = h * 2 * sizeof(unsigned char *); | ||
157 | if (sz != 0) memset(data, 0, sz); | ||
152 | } | 158 | } |
153 | evas_object_image_data_set(img, data); | 159 | evas_object_image_data_set(img, data); |
154 | } | 160 | } |
@@ -335,6 +341,7 @@ emotion_object_file_set(Evas_Object *obj, const char *file) | |||
335 | free(sd->file); | 341 | free(sd->file); |
336 | sd->file = strdup(file); | 342 | sd->file = strdup(file); |
337 | sd->module->file_close(sd->video); | 343 | sd->module->file_close(sd->video); |
344 | evas_object_image_data_set(sd->obj, NULL); | ||
338 | evas_object_image_size_set(sd->obj, 1, 1); | 345 | evas_object_image_size_set(sd->obj, 1, 1); |
339 | if (!sd->module->file_open(sd->file, obj, sd->video)) | 346 | if (!sd->module->file_open(sd->file, obj, sd->video)) |
340 | return EINA_FALSE; | 347 | return EINA_FALSE; |
@@ -350,6 +357,7 @@ emotion_object_file_set(Evas_Object *obj, const char *file) | |||
350 | if (sd->video && sd->module) | 357 | if (sd->video && sd->module) |
351 | { | 358 | { |
352 | sd->module->file_close(sd->video); | 359 | sd->module->file_close(sd->video); |
360 | evas_object_image_data_set(sd->obj, NULL); | ||
353 | evas_object_image_size_set(sd->obj, 1, 1); | 361 | evas_object_image_size_set(sd->obj, 1, 1); |
354 | _emotion_image_data_zero(sd->obj); | 362 | _emotion_image_data_zero(sd->obj); |
355 | } | 363 | } |