search: Cancel thread when closing.

We need to ensure we cancel the search thread especially on exit
to avoid a SEGV due to some horrible side-effects of EFL
shutting down as we search.
This commit is contained in:
Alastair Poole 2020-02-02 19:21:48 +00:00
parent 8bceeec424
commit 03e8564cb4
3 changed files with 18 additions and 6 deletions

View File

@ -1783,6 +1783,7 @@ edi_open(const char *inputpath)
void void
edi_close() edi_close()
{ {
edi_searchpanel_stop();
edi_debugpanel_stop(); edi_debugpanel_stop();
elm_exit(); elm_exit();
} }

View File

@ -33,6 +33,13 @@ _edi_searchpanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED,
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }
void
edi_searchpanel_stop(void)
{
if (_search_thread)
ecore_thread_cancel(_search_thread);
}
static void static void
_edi_searchpanel_line_clicked_cb(void *data EINA_UNUSED, const Efl_Event *event) _edi_searchpanel_line_clicked_cb(void *data EINA_UNUSED, const Efl_Event *event)
{ {
@ -498,13 +505,10 @@ _edi_searchpanel_search_project(const char *directory, const char *search_term,
{ {
case EINA_FILE_REG: case EINA_FILE_REG:
{ {
if (ecore_thread_check(_search_thread)) return;
const char *mime = edi_mime_type_get(info->path); const char *mime = edi_mime_type_get(info->path);
if (!mime)
{
// If we're in a search and EDI is shutting down we
// need to return here.
return;
}
if (strncmp(mime, "text/", 5)) if (strncmp(mime, "text/", 5))
break; break;

View File

@ -32,6 +32,13 @@ extern "C" {
*/ */
void edi_searchpanel_add(Evas_Object *parent); void edi_searchpanel_add(Evas_Object *parent);
/**
* Cancel a search that is in progress.
*
* @ingroup UI
*/
void edi_searchpanel_stop(void);
/** /**
* Show the Edi searchpanel - animating on to screen if required. * Show the Edi searchpanel - animating on to screen if required.
* *