Hi,

        I think I found a bug due to ecore_job inside edje. Take the following 
code 
as an example :

   /* First run of ecore */
   ecore_init();
   ecore_evas_init();
   edje_init();

   setup();

   ecore_evas_show(ee);

   ecore_main_loop_begin();

   evas_object_del(eo_bg);

   ecore_evas_free(ee);

   edje_shutdown();
   ecore_evas_shutdown();
   ecore_shutdown();

   /* Second call. */
   ecore_init();
   ecore_evas_init();
   edje_init();

   setup();

   ecore_evas_show(ee);

   ecore_main_loop_begin();

   evas_object_del(eo_bg);

   ecore_evas_free(ee);

   edje_shutdown();
   ecore_evas_shutdown();
   ecore_shutdown();
   /* End of sample code. */

        The edje you will instantiate inside the second call will never receive 
any 
signal.
        It's due to two bugs, first inside edje, _edje_timer and job_loss_timer 
could 
stay alive after edje_shutdown and never get reinitialised. And inside 
ecore_job, ecore_event_job_type and it's handler will not being reseted 
correctly.

        As a patch we could add an ecore_job_init/ecore_job_shutdown that do 
the 
reset properly. The patch are attached, but this solution break every 
application/library using it.

Cedric
diff -Nrau -X exclude.cvs -x enlightenment_thumb -x enlightenment_sys -x enlightenment_start -x enlightenment_remote -x enlightenment_imc -x enlightenment_fm -x enlightenment_eapp_cache_gen -x enlightenment_eapp -x enlightenment e17-clean/apps/e/src/bin/e_fm.c e17-dev/apps/e/src/bin/e_fm.c
--- e17-clean/apps/e/src/bin/e_fm.c	2007-08-22 17:48:13.000000000 +0200
+++ e17-dev/apps/e/src/bin/e_fm.c	2007-09-15 18:57:03.000000000 +0200
@@ -370,6 +370,7 @@
    const char *homedir;
    char  path[PATH_MAX];
 
+   ecore_job_init();
    _e_storage_volume_edd_init();
    homedir = e_user_homedir_get();
    snprintf(path, sizeof(path), "%s/.e/e/fileman/metadata", homedir);
@@ -409,6 +410,7 @@
    e_fm2_custom_file_shutdown();
    _e_storage_volume_edd_shutdown();
    efreet_mime_shutdown();
+   ecore_job_shutdown();
    return 1;
 }
 
diff -Nrau -X exclude.cvs -x enlightenment_thumb -x enlightenment_sys -x enlightenment_start -x enlightenment_remote -x enlightenment_imc -x enlightenment_fm -x enlightenment_eapp_cache_gen -x enlightenment_eapp -x enlightenment e17-clean/apps/e/src/bin/e_main.c e17-dev/apps/e/src/bin/e_main.c
--- e17-clean/apps/e/src/bin/e_main.c	2007-08-22 17:48:13.000000000 +0200
+++ e17-dev/apps/e/src/bin/e_main.c	2007-09-15 18:59:24.000000000 +0200
@@ -313,6 +313,7 @@
 			       "Perhaps you are out of memory?"));
 	exit(-1);
      }
+   ecore_job_init();
 // FIXME: SEGV's on shutdown if fm2 windows up - disable for now.   
 //   _e_main_shutdown_push(ecore_shutdown);
 
diff -Nrau -X exclude.cvs e17-clean/libs/etk/src/lib/etk_main.c e17-dev/libs/etk/src/lib/etk_main.c
--- e17-clean/libs/etk/src/lib/etk_main.c	2007-08-22 17:48:15.000000000 +0200
+++ e17-dev/libs/etk/src/lib/etk_main.c	2007-09-15 19:10:48.000000000 +0200
@@ -83,6 +83,11 @@
          ETK_WARNING("Ecore initialization failed!");
          return 0;
       }
+      if (!ecore_job_init())
+      {
+         ETK_WARNING("Ecore_Job initialization failed!");
+         return 0;
+      }
       if (!edje_init())
       {
          ETK_WARNING("Edje initialization failed!");
@@ -154,6 +159,7 @@
 
       /* Shutdown the EFL*/
       edje_shutdown();
+      ecore_job_shutdown();
       ecore_shutdown();
       evas_shutdown();
    }
--- e17-clean/test/orig/ecore/ecore_test.c	2007-03-20 18:54:56.000000000 +0100
+++ e17-dev/test/orig/ecore/ecore_test.c	2007-09-15 19:12:48.000000000 +0200
@@ -738,6 +738,8 @@
 
    /* init ecore */
    ecore_init();
+   /* init ecore job */
+   ecore_job_init();
    /* tell ecore what our arguments are */
    ecore_app_args_set(argc, argv);
 
@@ -835,6 +837,8 @@
    ecore_ipc_shutdown();
    /* shut down ecore_con */
    ecore_con_shutdown();
+   /* shut down ecore_job */
+   ecore_job_shutdown();
    /* shut down ecore */
    ecore_shutdown();
    return 0;
diff -Nrau -X exclude.cvs e17-clean/libs/edje/src/lib/edje_main.c e17-dev/libs/edje/src/lib/edje_main.c
--- e17-clean/libs/edje/src/lib/edje_main.c	2007-06-04 09:17:09.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_main.c	2007-09-15 18:28:02.000000000 +0200
@@ -4,6 +4,8 @@
 
 #include <time.h>
 
+#include <Ecore_Job.h>
+
 #include "Edje.h"
 #include "edje_private.h"
 
@@ -21,6 +23,7 @@
    initted++;
    if (initted == 1)
      {
+        ecore_job_init();
 	srand(time(NULL));
 	_edje_edd_setup();
 	_edje_text_init();
@@ -40,6 +43,10 @@
    initted--;
    if (initted > 0) return initted;
 
+   if (_edje_timer)
+     ecore_animator_del(_edje_timer);
+   _edje_timer = NULL;
+
    _edje_file_cache_shutdown();
    _edje_message_shutdown();
    _edje_edd_free();
@@ -48,7 +55,8 @@
    _edje_text_class_members_free();
    _edje_text_class_hash_free();
    embryo_shutdown();
-   
+   ecore_job_shutdown();
+
    return 0;
 }
 
diff -Nrau -X exclude.cvs e17-clean/libs/edje/src/lib/edje_message_queue.c e17-dev/libs/edje/src/lib/edje_message_queue.c
--- e17-clean/libs/edje/src/lib/edje_message_queue.c	2007-08-22 17:48:14.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_message_queue.c	2007-09-15 18:31:34.000000000 +0200
@@ -124,7 +124,12 @@
 _edje_message_shutdown(void)
 {
    _edje_message_queue_clear();
+   if (job_loss_timer)
+     ecore_timer_del(job_loss_timer);
+   if (job)
+     ecore_job_del(job);
    job = NULL;
+   job_loss_timer = NULL;
 }
 
 void
diff -Nrau -X exclude.cvs e17-clean/libs/emotion/src/lib/emotion_smart.c e17-dev/libs/emotion/src/lib/emotion_smart.c
--- e17-clean/libs/emotion/src/lib/emotion_smart.c	2007-08-06 16:51:03.000000000 +0200
+++ e17-dev/libs/emotion/src/lib/emotion_smart.c	2007-09-15 19:08:07.000000000 +0200
@@ -193,12 +192,15 @@
    sd->seek_pos = 0;
    sd->len = 0;
 
+   ecore_job_init();
+
    if ((!sd->module) || (!sd->video))
      {
 	if (!_emotion_module_open(module_filename, obj,
 				  &sd->module, &sd->video))
 	  return 0;
      }
+
    return 1;
 }
 
@@ -1183,6 +1185,8 @@
    if (sd->progress.info) free(sd->progress.info);
    if (sd->ref.file) free(sd->ref.file);
    free(sd);
+
+   ecore_job_shutdown();
 }
 
 static void
diff -Nrau -X exclude.cvs e17-clean/libs/ecore/src/lib/ecore_job/ecore_job.c e17-dev/libs/ecore/src/lib/ecore_job/ecore_job.c
--- e17-clean/libs/ecore/src/lib/ecore_job/ecore_job.c	2007-03-20 18:54:38.000000000 +0100
+++ e17-dev/libs/ecore/src/lib/ecore_job/ecore_job.c	2007-09-15 18:48:29.000000000 +0200
@@ -7,6 +7,34 @@
 static void _ecore_job_event_free(void *data, void *ev);
     
 static int ecore_event_job_type = 0;
+static int _ecore_init_job_count = 0;
+static Ecore_Event_Handler* _ecore_job_handler = NULL;
+
+EAPI int
+ecore_job_init()
+{
+   if (++_ecore_init_job_count == 1)
+     {
+        ecore_init();
+	ecore_event_job_type = ecore_event_type_new();
+	_ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL);
+     }
+
+   return _ecore_init_job_count;
+}
+
+EAPI int
+ecore_job_shutdown()
+{
+   if (--_ecore_init_job_count)
+     return _ecore_init_job_count;
+
+   ecore_event_handler_del(_ecore_job_handler);
+   _ecore_job_handler = NULL;
+   ecore_shutdown();
+
+   return _ecore_init_job_count;
+}
 
 /**
  * Add a job to the event queue.
@@ -24,11 +52,7 @@
    Ecore_Job *job;
    
    if (!func) return NULL;
-   if (!ecore_event_job_type)
-     {
-	ecore_event_job_type = ecore_event_type_new();
-	ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL);
-     }
+
    job = calloc(1, sizeof(Ecore_Job));
    if (!job) return NULL;
    ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB);
diff -Nrau -X exclude.cvs e17-clean/libs/ecore/src/lib/ecore_job/Ecore_Job.h e17-dev/libs/ecore/src/lib/ecore_job/Ecore_Job.h
--- e17-clean/libs/ecore/src/lib/ecore_job/Ecore_Job.h	2007-03-20 18:54:38.000000000 +0100
+++ e17-dev/libs/ecore/src/lib/ecore_job/Ecore_Job.h	2007-09-15 18:19:05.000000000 +0200
@@ -35,6 +35,8 @@
 typedef void Ecore_Job; /**< A job handle */
 #endif
 
+EAPI int        ecore_job_init();
+EAPI int        ecore_job_shutdown();
 EAPI Ecore_Job *ecore_job_add(void (*func) (void *data), const void *data);    
 EAPI void      *ecore_job_del(Ecore_Job *job);
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to