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)
downloadefl-9cb7eac7d268fe91a71bc238df7be391dfb89076.tar.gz
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 @@
2012-08-28 Cedric Bail
* Reset VLC pipeline on EOS.
+ * 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:
- fix race condition in gstreamer render function on shutdown and file set.
- fix priority set/get for gstreamer.
- reset VLC pipeline on EOS.
+ - fix race condition on shutdown when still saving a file position.
Improvements:
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
#ifdef HAVE_EIO
Eio_File *load_xattr;
+ Eio_File *save_xattr;
#endif
struct {
@@ -481,6 +482,8 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
/* Only cancel the load_xattr or we will loose ref to time_seek stringshare */
if (sd->load_xattr) eio_file_cancel(sd->load_xattr);
sd->load_xattr = NULL;
+ if (sd->save_xattr) eio_file_cancel(sd->save_xattr);
+ sd->save_xattr = NULL;
#endif
return EINA_TRUE;
@@ -1416,19 +1419,30 @@ emotion_object_last_position_load(Evas_Object *obj)
#ifdef HAVE_EIO
static void
-_eio_save_xattr_done(void *data, Eio_File *handler __UNUSED__)
+_eio_save_xattr_cleanup(Smart_Data *sd, Eio_File *handler)
+{
+ if (handler == sd->save_xattr) sd->save_xattr = NULL;
+
+ EINA_REFCOUNT_UNREF(sd)
+ _smart_data_free(sd);
+}
+
+static void
+_eio_save_xattr_done(void *data, Eio_File *handler)
{
Smart_Data *sd = data;
evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_SUCCEED, NULL);
+ _eio_save_xattr_cleanup(sd, handler);
}
static void
-_eio_save_xattr_error(void *data, Eio_File *handler __UNUSED__, int err __UNUSED__)
+_eio_save_xattr_error(void *data, Eio_File *handler, int err __UNUSED__)
{
Smart_Data *sd = data;
evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_FAILED, NULL);
+ _eio_save_xattr_cleanup(sd, handler);
}
#endif
@@ -1449,8 +1463,17 @@ emotion_object_last_position_save(Evas_Object *obj)
return ;
#ifdef HAVE_EIO
- eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0,
- _eio_save_xattr_done, _eio_save_xattr_error, sd);
+ if (sd->save_xattr) return ;
+
+ EINA_REFCOUNT_REF(sd);
+
+ sd->save_xattr = eio_file_xattr_double_set(tmp,
+ "user.e.time_seek",
+ emotion_object_position_get(obj),
+ 0,
+ _eio_save_xattr_done,
+ _eio_save_xattr_error,
+ sd);
#else
if (eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0))
evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_SUCCEED, NULL);