diff options
author | Carsten Haitzler <raster@rasterman.com> | 2010-10-10 23:39:32 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2010-10-10 23:39:32 +0000 |
commit | 66771ce7f2342e20f7df37074c5a54b634952770 (patch) | |
tree | e0499e2f7d1f23166e9b3de6fe0dfe75822fb7ba /legacy/emotion/src/lib/emotion_smart.c | |
parent | a704be12199f7769d8286523c786a43b7bd98a1e (diff) |
avoid possible seg if accessing video dat for convert before its
decided and set.
SVN revision: 53246
Diffstat (limited to '')
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 0526bb1f07..30d0951b40 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -136,9 +136,25 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { | |||
136 | {NULL, NULL} | 136 | {NULL, NULL} |
137 | }; | 137 | }; |
138 | 138 | ||
139 | static void | ||
140 | _emotion_image_data_zero(Evas_Object *img) | ||
141 | { | ||
142 | void *data; | ||
143 | |||
144 | data = evas_object_image_data_get(img, 1); | ||
145 | if (data) | ||
146 | { | ||
147 | int w, h, sz; | ||
148 | |||
149 | evas_object_image_size_get(img, &w, &h); | ||
150 | sz = w * h * 4; | ||
151 | memset(data, 0, sz); | ||
152 | } | ||
153 | evas_object_image_data_set(img, data); | ||
154 | } | ||
139 | 155 | ||
140 | EAPI Eina_Bool | 156 | EAPI Eina_Bool |
141 | _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close) | 157 | _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close) |
142 | { | 158 | { |
143 | Eina_Emotion_Plugins *plugin; | 159 | Eina_Emotion_Plugins *plugin; |
144 | 160 | ||
@@ -316,11 +332,12 @@ emotion_object_file_set(Evas_Object *obj, const char *file) | |||
316 | free(sd->file); | 332 | free(sd->file); |
317 | sd->file = strdup(file); | 333 | sd->file = strdup(file); |
318 | sd->module->file_close(sd->video); | 334 | sd->module->file_close(sd->video); |
319 | evas_object_image_size_set(sd->obj, 0, 0); | 335 | evas_object_image_size_set(sd->obj, 1, 1); |
320 | if (!sd->module->file_open(sd->file, obj, sd->video)) | 336 | if (!sd->module->file_open(sd->file, obj, sd->video)) |
321 | return; | 337 | return; |
322 | sd->module->size_get(sd->video, &w, &h); | 338 | sd->module->size_get(sd->video, &w, &h); |
323 | evas_object_image_size_set(sd->obj, w, h); | 339 | evas_object_image_size_set(sd->obj, w, h); |
340 | _emotion_image_data_zero(sd->obj); | ||
324 | sd->ratio = sd->module->ratio_get(sd->video); | 341 | sd->ratio = sd->module->ratio_get(sd->video); |
325 | sd->pos = 0.0; | 342 | sd->pos = 0.0; |
326 | if (sd->play) sd->module->play(sd->video, 0.0); | 343 | if (sd->play) sd->module->play(sd->video, 0.0); |
@@ -330,7 +347,8 @@ emotion_object_file_set(Evas_Object *obj, const char *file) | |||
330 | if (sd->video && sd->module) | 347 | if (sd->video && sd->module) |
331 | { | 348 | { |
332 | sd->module->file_close(sd->video); | 349 | sd->module->file_close(sd->video); |
333 | evas_object_image_size_set(sd->obj, 0, 0); | 350 | evas_object_image_size_set(sd->obj, 1, 1); |
351 | _emotion_image_data_zero(sd->obj); | ||
334 | } | 352 | } |
335 | free(sd->file); | 353 | free(sd->file); |
336 | sd->file = NULL; | 354 | sd->file = NULL; |
@@ -1015,6 +1033,7 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio) | |||
1015 | if (h > 0) sd->ratio = (double)w / (double)h; | 1033 | if (h > 0) sd->ratio = (double)w / (double)h; |
1016 | else sd->ratio = 1.0; | 1034 | else sd->ratio = 1.0; |
1017 | evas_object_image_size_set(sd->obj, w, h); | 1035 | evas_object_image_size_set(sd->obj, w, h); |
1036 | _emotion_image_data_zero(sd->obj); | ||
1018 | changed = 1; | 1037 | changed = 1; |
1019 | } | 1038 | } |
1020 | if (ratio != sd->ratio) | 1039 | if (ratio != sd->ratio) |
@@ -1222,6 +1241,7 @@ _pixels_get(void *data, Evas_Object *obj) | |||
1222 | evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL); | 1241 | evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL); |
1223 | evas_object_image_alpha_set(obj, 0); | 1242 | evas_object_image_alpha_set(obj, 0); |
1224 | evas_object_image_size_set(obj, w, h); | 1243 | evas_object_image_size_set(obj, w, h); |
1244 | _emotion_image_data_zero(sd->obj); | ||
1225 | iw = w; | 1245 | iw = w; |
1226 | ih = h; | 1246 | ih = h; |
1227 | } | 1247 | } |
@@ -1271,6 +1291,7 @@ _pixels_get(void *data, Evas_Object *obj) | |||
1271 | if ((w != iw) || (h != ih)) | 1291 | if ((w != iw) || (h != ih)) |
1272 | { | 1292 | { |
1273 | evas_object_image_size_set(obj, w, h); | 1293 | evas_object_image_size_set(obj, w, h); |
1294 | _emotion_image_data_zero(sd->obj); | ||
1274 | iw = w; | 1295 | iw = w; |
1275 | ih = h; | 1296 | ih = h; |
1276 | } | 1297 | } |