<commit_before>#include "Elementary.h"
#include "private.h"

int _elm_ext_log_dom = -1;

static int init_count = 0;

void
external_elm_init(void)
{
   int argc = 0;
   char **argv = NULL;

   init_count++;
   DBG("elm_real_init\n");
   if (init_count > 1) return;
   ecore_app_args_get(&argc, &argv);
   elm_init(argc, argv);
}

static void
external_elm_shutdown(void)
{
   init_count--;
   DBG("elm_real_shutdown\n");
   if (init_count > 0) return;
   elm_shutdown();
}

static void
_external_obj_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
   evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
                                  _external_obj_del);
   external_elm_shutdown();
}

void
external_signal(void *data __UNUSED__, Evas_Object *obj, const char *sig, const char *source)
{
   char *_signal = strdup(sig);
   char *p = _signal;
   Evas_Object *content;

   while ((*p!='\0') && (*p!=']'))
     p++;


   if ((*p=='\0') || (*(p+1)!=':'))
     {
        ERR("Invalid External Signal received: '%s' '%s'\n", sig, source);
        free(_signal);
        return ;
     }<commit_msg>[elm] Fix elm_shutdown via Edje externals. An EVAS_CALLBACK_DEL event cb will take place before the smart del function, so there'll be more action taking place after that, and Elm has be on.<commit_after>#include "Elementary.h"
#include "private.h"

int _elm_ext_log_dom = -1;

static int init_count = 0;

void
external_elm_init(void)
{
   int argc = 0;
   char **argv = NULL;

   init_count++;
   DBG("elm_real_init\n");
   if (init_count > 1) return;
   ecore_app_args_get(&argc, &argv);
   elm_init(argc, argv);
}

static Eina_Bool
_shutdown_idler(void *data)
{
   elm_shutdown();

   return ECORE_CALLBACK_CANCEL;
}

static void
external_elm_shutdown(void)
{
   init_count--;
   DBG("elm_real_shutdown\n");
   if (init_count > 0) return;

   ecore_idler_add(_shutdown_idler, NULL);
}

static void
_external_obj_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
   evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
                                  _external_obj_del);
   external_elm_shutdown();
}

void
external_signal(void *data __UNUSED__, Evas_Object *obj, const char *sig, const char *source)
{
   char *_signal = strdup(sig);
   char *p = _signal;
   Evas_Object *content;

   while ((*p!='\0') && (*p!=']'))
     p++;


   if ((*p=='\0') || (*(p+1)!=':'))
     {
        ERR("Invalid External Signal received: '%s' '%s'\n", sig, source);
        free(_signal);
        return ;
     }
{'fraction_non_alphanumeric': 0.14153490165831084, 'fraction_numerical': 0.006170458927882761, 'mean_word_length': 3.542907180385289, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1274968', 'n_tokens_mistral': 981, 'n_tokens_neox': 954, 'n_words': 225}