edje: Fix multisense shutdown and shut up ecore thread shutdown.
authorngc891 <ngc891@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 14 Jul 2012 06:58:42 +0000 (06:58 +0000)
committerngc891 <ngc891@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 14 Jul 2012 06:58:42 +0000 (06:58 +0000)
Patch from cedric during the korean e17 meeting. Thanks!

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@73841 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/edje_multisense.c

index 508d904..563cc37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Warn at compile time about forgotten image definition.
        * Stop compilation when clipping to a non RECT part.
+
+2012-07-14  Cedric Bail
+
+       * Fix Edje_Multisense shutdown.
diff --git a/NEWS b/NEWS
index a7fc6f4..0073072 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Fixes:
     * Fix table and text when fixed point is turned on.
     * Clamp image tween to never underflow also.
     * [entry] display preedit string even though there is no attribute
+    * Fix shutdown of Edje_Multisense.
 
 Edje 1.2.0
 
index 715dc0c..4c6fa14 100644 (file)
@@ -283,13 +283,17 @@ _player_job(void *data __UNUSED__, Ecore_Thread *th)
      {
         if (!msdata->remaining)
           {
-             //Cleanup already played sound sources
+            int err;
+             
+            //Cleanup already played sound sources
              EINA_LIST_FREE(msdata->snd_src_list, sound)
                {
                   remix_destroy(msdata->msenv->remixenv, sound);
                }
              //wait for new sound
-             select(command_pipe[0] + 1, &wait_fds, NULL, NULL, 0);
+             err = select(command_pipe[0] + 1, &wait_fds, NULL, NULL, 0);
+            if (ecore_thread_check(th))
+              break;
           }
         //read sound command , if any
         sound_command_handler(msdata);
@@ -305,9 +309,6 @@ _player_job(void *data __UNUSED__, Ecore_Thread *th)
      {
         remix_destroy(msdata->msenv->remixenv, sound);
      }
-
-   close(command_pipe[0]);
-   close(command_pipe[1]);
 }
 #endif
 
@@ -400,7 +401,7 @@ _edje_multisense_init(void)
    if (!msdata) msdata = init_multisense_environment();
 
    if (!player_thread)
-     player_thread = ecore_thread_run(_player_job, _player_end, _player_cancel, NULL);
+     player_thread = ecore_thread_feedback_run(_player_job, NULL, _player_end, _player_cancel, NULL, EINA_TRUE);
 #endif
 }
 
@@ -408,11 +409,14 @@ void
 _edje_multisense_shutdown(void)
 {
 #ifdef ENABLE_MULTISENSE
+   if (player_thread) ecore_thread_cancel(player_thread);
    if (pipe_initialized)
      {
+        int i = 42;
+
+        write(command_pipe[1], &i, sizeof (int));
         close(command_pipe[1]);
         close(command_pipe[0]);
      }
-   if (player_thread) ecore_thread_cancel(player_thread);
 #endif
 }