summaryrefslogtreecommitdiff
path: root/src/bin/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-29 19:45:13 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-30 19:48:17 +0900
commit2b8e74e623c33c1f218f7eec6d3ff6eea2d2b09d (patch)
tree87102f16f065c90982af173b2596621f01ff06e4 /src/bin/evas
parent82e8028b5d34ccf488eb3faed30f67b4b40bfaed (diff)
evas/cserve2: Fix crash in server when an image file changes
Since cserve2 uses inotify to track image file updates, it will drop its references to a specific file and all the associated images. Fix some logic in the deletion code.
Diffstat (limited to 'src/bin/evas')
-rw-r--r--src/bin/evas/evas_cserve2_cache.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 4c20a72d33..4322be2386 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -1075,9 +1075,12 @@ _image_entry_free(Image_Entry *ientry)
1075 if (fd) 1075 if (fd)
1076 { 1076 {
1077 fentry = _file_entry_find(fd->id); 1077 fentry = _file_entry_find(fd->id);
1078 fentry->images = eina_list_remove(fentry->images, ientry); 1078 if (fentry)
1079 if (fentry && !fentry->images && !ASENTRY(fentry)->references) 1079 {
1080 eina_hash_del_by_key(file_entries, &fd->id); 1080 fentry->images = eina_list_remove(fentry->images, ientry);
1081 if (!fentry->images && !ASENTRY(fentry)->references)
1082 eina_hash_del_by_key(file_entries, &fd->id);
1083 }
1081 } 1084 }
1082 else 1085 else
1083 ERR("Could not find file data %u for image %u", 1086 ERR("Could not find file data %u for image %u",
@@ -1669,18 +1672,14 @@ static void
1669_file_changed_cb(const char *path EINA_UNUSED, Eina_Bool deleted EINA_UNUSED, void *data) 1672_file_changed_cb(const char *path EINA_UNUSED, Eina_Bool deleted EINA_UNUSED, void *data)
1670{ 1673{
1671 File_Watch *fw = data; 1674 File_Watch *fw = data;
1672 File_Data *fd; 1675 File_Entry *fentry;
1673 Eina_List *l; 1676 Eina_List *l;
1674 1677
1675 EINA_LIST_FOREACH(fw->entries, l, fd) 1678 EINA_LIST_FOREACH(fw->entries, l, fentry)
1676 { 1679 {
1677 Eina_List *ll; 1680 Eina_List *ll;
1678 Image_Entry *ie; 1681 Image_Entry *ie;
1679 File_Entry *fentry; 1682 File_Data *fd;
1680
1681 fd->invalid = EINA_TRUE;
1682 fentry = _file_entry_find(fd->id);
1683 if (!fentry) continue;
1684 1683
1685 fentry->watcher = NULL; 1684 fentry->watcher = NULL;
1686 1685
@@ -1688,13 +1687,13 @@ _file_changed_cb(const char *path EINA_UNUSED, Eina_Bool deleted EINA_UNUSED, vo
1688 { 1687 {
1689 Image_Data *idata; 1688 Image_Data *idata;
1690 1689
1690 idata = _image_data_find(ENTRYID(ie));
1691 eina_hash_set(image_entries, &ENTRYID(ie), NULL); 1691 eina_hash_set(image_entries, &ENTRYID(ie), NULL);
1692 if (ASENTRY(ie)->request /*&& !ie->base.request->processing*/) 1692 if (ASENTRY(ie)->request /*&& !ie->base.request->processing*/)
1693 cserve2_request_cancel_all(ASENTRY(ie)->request, 1693 cserve2_request_cancel_all(ASENTRY(ie)->request,
1694 CSERVE2_FILE_CHANGED); 1694 CSERVE2_FILE_CHANGED);
1695 ASENTRY(ie)->request = NULL; 1695 ASENTRY(ie)->request = NULL;
1696 1696
1697 idata = _image_data_find(ENTRYID(ie));
1698 if (idata) 1697 if (idata)
1699 { 1698 {
1700 _image_id_free(idata); 1699 _image_id_free(idata);
@@ -1703,8 +1702,15 @@ _file_changed_cb(const char *path EINA_UNUSED, Eina_Bool deleted EINA_UNUSED, vo
1703 } 1702 }
1704 } 1703 }
1705 1704
1706 _file_id_free(fd); 1705
1707 eina_hash_set(file_entries, &fd->id, NULL); 1706 fd = _file_data_find(ENTRYID(fentry));
1707 if (fd)
1708 {
1709 fd->invalid = EINA_TRUE;
1710 _file_id_free(fd);
1711 eina_hash_set(file_entries, &fd->id, NULL);
1712 }
1713
1708 if (ASENTRY(fentry)->request 1714 if (ASENTRY(fentry)->request
1709 /*&& !ASENTRY(fentry)->request->processing*/) 1715 /*&& !ASENTRY(fentry)->request->processing*/)
1710 { 1716 {