summaryrefslogtreecommitdiff
path: root/legacy/emotion
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-08-28 09:27:54 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-08-28 09:27:54 +0000
commit9cb7eac7d268fe91a71bc238df7be391dfb89076 (patch)
tree1d3e27894876391a1dcec5c4a419acbd0db96132 /legacy/emotion
parent97aec1869f7611f16b23f0d66a3539b71ebd9a59 (diff)
emotion: fix a race condition on shutdown when still saving a file.
SVN revision: 75770
Diffstat (limited to 'legacy/emotion')
-rw-r--r--legacy/emotion/ChangeLog1
-rw-r--r--legacy/emotion/NEWS1
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c31
3 files changed, 29 insertions, 4 deletions
diff --git a/legacy/emotion/ChangeLog b/legacy/emotion/ChangeLog
index 2aaa70cf90..c85115a5c9 100644
--- a/legacy/emotion/ChangeLog
+++ b/legacy/emotion/ChangeLog
@@ -45,3 +45,4 @@
452012-08-28 Cedric Bail 452012-08-28 Cedric Bail
46 46
47 * Reset VLC pipeline on EOS. 47 * Reset VLC pipeline on EOS.
48 * Fix a race condition on shutdown when still saving a file position.
diff --git a/legacy/emotion/NEWS b/legacy/emotion/NEWS
index 07d2b98378..cedcaf4662 100644
--- a/legacy/emotion/NEWS
+++ b/legacy/emotion/NEWS
@@ -16,6 +16,7 @@ Fixes:
16 - fix race condition in gstreamer render function on shutdown and file set. 16 - fix race condition in gstreamer render function on shutdown and file set.
17 - fix priority set/get for gstreamer. 17 - fix priority set/get for gstreamer.
18 - reset VLC pipeline on EOS. 18 - reset VLC pipeline on EOS.
19 - fix race condition on shutdown when still saving a file position.
19 20
20Improvements: 21Improvements:
21 22
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 873b587c21..48eafdacc7 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -71,6 +71,7 @@ struct _Smart_Data
71 71
72#ifdef HAVE_EIO 72#ifdef HAVE_EIO
73 Eio_File *load_xattr; 73 Eio_File *load_xattr;
74 Eio_File *save_xattr;
74#endif 75#endif
75 76
76 struct { 77 struct {
@@ -481,6 +482,8 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
481 /* Only cancel the load_xattr or we will loose ref to time_seek stringshare */ 482 /* Only cancel the load_xattr or we will loose ref to time_seek stringshare */
482 if (sd->load_xattr) eio_file_cancel(sd->load_xattr); 483 if (sd->load_xattr) eio_file_cancel(sd->load_xattr);
483 sd->load_xattr = NULL; 484 sd->load_xattr = NULL;
485 if (sd->save_xattr) eio_file_cancel(sd->save_xattr);
486 sd->save_xattr = NULL;
484#endif 487#endif
485 488
486 return EINA_TRUE; 489 return EINA_TRUE;
@@ -1416,19 +1419,30 @@ emotion_object_last_position_load(Evas_Object *obj)
1416 1419
1417#ifdef HAVE_EIO 1420#ifdef HAVE_EIO
1418static void 1421static void
1419_eio_save_xattr_done(void *data, Eio_File *handler __UNUSED__) 1422_eio_save_xattr_cleanup(Smart_Data *sd, Eio_File *handler)
1423{
1424 if (handler == sd->save_xattr) sd->save_xattr = NULL;
1425
1426 EINA_REFCOUNT_UNREF(sd)
1427 _smart_data_free(sd);
1428}
1429
1430static void
1431_eio_save_xattr_done(void *data, Eio_File *handler)
1420{ 1432{
1421 Smart_Data *sd = data; 1433 Smart_Data *sd = data;
1422 1434
1423 evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_SUCCEED, NULL); 1435 evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_SUCCEED, NULL);
1436 _eio_save_xattr_cleanup(sd, handler);
1424} 1437}
1425 1438
1426static void 1439static void
1427_eio_save_xattr_error(void *data, Eio_File *handler __UNUSED__, int err __UNUSED__) 1440_eio_save_xattr_error(void *data, Eio_File *handler, int err __UNUSED__)
1428{ 1441{
1429 Smart_Data *sd = data; 1442 Smart_Data *sd = data;
1430 1443
1431 evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_FAILED, NULL); 1444 evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_FAILED, NULL);
1445 _eio_save_xattr_cleanup(sd, handler);
1432} 1446}
1433#endif 1447#endif
1434 1448
@@ -1449,8 +1463,17 @@ emotion_object_last_position_save(Evas_Object *obj)
1449 return ; 1463 return ;
1450 1464
1451#ifdef HAVE_EIO 1465#ifdef HAVE_EIO
1452 eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0, 1466 if (sd->save_xattr) return ;
1453 _eio_save_xattr_done, _eio_save_xattr_error, sd); 1467
1468 EINA_REFCOUNT_REF(sd);
1469
1470 sd->save_xattr = eio_file_xattr_double_set(tmp,
1471 "user.e.time_seek",
1472 emotion_object_position_get(obj),
1473 0,
1474 _eio_save_xattr_done,
1475 _eio_save_xattr_error,
1476 sd);
1454#else 1477#else
1455 if (eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0)) 1478 if (eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0))
1456 evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_SUCCEED, NULL); 1479 evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_SUCCEED, NULL);