summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-11 13:38:21 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-11 13:38:21 -0400
commit54894824847c69b1acaa0a4382de6e39bf83a66b (patch)
tree93ac7ded917c606adac201128274b78b6e97cd51
parent7f691b47fb1d9742380a0222915503110e5a22fa (diff)
efl: check file's mtime in efl.file::file_set to determine if file is the same
Summary: historically, if the mtime of an edj file changes after being loaded, the edje file should be reloaded. this needs to occur in a single call with the previous user definitions intact, so verify that the mtime is the same in efl.file::file_set when using the same file name @fix Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9877
-rw-r--r--src/lib/edje/edje_smart.c12
-rw-r--r--src/lib/efl/interfaces/efl_file.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 674c7cd..4801432 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -466,17 +466,7 @@ edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group)
466EAPI Eina_Bool 466EAPI Eina_Bool
467edje_object_file_set(Edje_Object *obj, const char *file, const char *group) 467edje_object_file_set(Edje_Object *obj, const char *file, const char *group)
468{ 468{
469 // We can't blindly unload here - this loses swallowed content (in 469 /* mtime checking of file is handled in efl.file mixin */
470 // swallows, boxes, tables etc.) ... this here along with an actual
471 // implementation of file unload broke the pager in E for starters
472 // as shading then unshading (double click titlebar) a window would
473 // lose the mini preview image obj swallowed in. also fullscreening
474 // would do it. this also broke gadget bar, the xkb gadget in it too
475 // and more... so this is a particularly bad thing break. we need to
476 // iterate over every child and re-swallow, re-pack into boxes, tables
477 // etc. because that is what edje used to do. unloading here is definitely
478 // worse ... so disable for now.
479 // efl_file_unload(obj);
480 return efl_file_simple_load(obj, file, group); 470 return efl_file_simple_load(obj, file, group);
481} 471}
482 472
diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c
index 846c88b..d6f262d 100644
--- a/src/lib/efl/interfaces/efl_file.c
+++ b/src/lib/efl/interfaces/efl_file.c
@@ -10,6 +10,7 @@ struct _Efl_File_Data
10 Eina_Stringshare *vpath; /* efl_file_set */ 10 Eina_Stringshare *vpath; /* efl_file_set */
11 Eina_Stringshare *key; /* efl_file_key_set */ 11 Eina_Stringshare *key; /* efl_file_key_set */
12 Eina_File *file; /* efl_file_mmap_set */ 12 Eina_File *file; /* efl_file_mmap_set */
13 time_t mtime;
13 Eina_Bool file_opened : 1; /* if `file` was opened implicitly during load */ 14 Eina_Bool file_opened : 1; /* if `file` was opened implicitly during load */
14 Eina_Bool setting : 1; /* set when this file is internally calling methods to avoid infinite recursion */ 15 Eina_Bool setting : 1; /* set when this file is internally calling methods to avoid infinite recursion */
15 Eina_Bool loaded : 1; /* whether the currently set file properties have been loaded */ 16 Eina_Bool loaded : 1; /* whether the currently set file properties have been loaded */
@@ -91,6 +92,7 @@ _efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file)
91 char *tmp; 92 char *tmp;
92 Eina_Error err = 0; 93 Eina_Error err = 0;
93 Eina_Bool same; 94 Eina_Bool same;
95 struct stat st;
94 96
95 tmp = (char*)(file); 97 tmp = (char*)(file);
96 if (tmp) 98 if (tmp)
@@ -98,9 +100,17 @@ _efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file)
98 100
99 same = !eina_stringshare_replace(&pd->vpath, tmp ?: file); 101 same = !eina_stringshare_replace(&pd->vpath, tmp ?: file);
100 free(tmp); 102 free(tmp);
103 if (file)
104 {
105 err = stat(pd->vpath, &st);
106 if (same && (!err)) same = st.st_mtime == pd->mtime;
107 }
101 if (same) return err; 108 if (same) return err;
109 pd->mtime = file && (!err) ? st.st_mtime : 0;
102 pd->loaded = EINA_FALSE; 110 pd->loaded = EINA_FALSE;
103 if (!pd->setting) 111 if (pd->setting)
112 err = 0; /* this is from mmap_set, which may provide a virtual file */
113 else
104 { 114 {
105 pd->setting = 1; 115 pd->setting = 1;
106 err = efl_file_mmap_set(obj, NULL); 116 err = efl_file_mmap_set(obj, NULL);