forked from enlightenment/edi
search: improve stability.
Some boundary issues and fixing search during a shutdown.
This commit is contained in:
parent
d862ba0247
commit
76ee7b8f5a
|
@ -201,6 +201,10 @@ edi_search_term(const char *start, const char *end, int boundary,
|
|||
cchunk = chunk = start + boundary < end ? boundary : end - start;
|
||||
do
|
||||
{
|
||||
if ((search + cchunk) > end)
|
||||
{
|
||||
cchunk = end - search;
|
||||
}
|
||||
lookup = memchr(search, *term, cchunk);
|
||||
|
||||
// Did we found the right word or not ?
|
||||
|
@ -494,7 +498,14 @@ _edi_searchpanel_search_project(const char *directory, const char *search_term,
|
|||
{
|
||||
case EINA_FILE_REG:
|
||||
{
|
||||
if (strncmp(edi_mime_type_get(info->path), "text/", 5))
|
||||
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))
|
||||
break;
|
||||
|
||||
_edi_searchpanel_search_project_file(info->path, search_term, logger);
|
||||
|
|
|
@ -54,11 +54,13 @@ edi_mime_type_get(const char *path)
|
|||
eina_file_close(f);
|
||||
|
||||
mime = efreet_mime_type_get(path);
|
||||
if ((strncmp(mime, "text/", 5)) && likely_text)
|
||||
if (mime && (strncmp(mime, "text/", 5)) && likely_text)
|
||||
{
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
// XXX: On efreet shutdown we can return NULL here.
|
||||
|
||||
return mime;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue