buffer: reorder destroy-recreate sequence to avoid cache to be destroyed.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 23 Jan 2009 15:28:43 +0000 (15:28 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 23 Jan 2009 15:28:43 +0000 (15:28 +0000)
users of buffer engine (ie: e_thumb_main.c) were broken since when
they resize the canvas they would implicitly call engine->setup()
again, which would destroy output and create it again. However the
cache could be destroyed and images using it would be bogus.

This does not happen if the process have other cache users, but
e_thumb is just one canvas live at time.

By reordering, we have the cache reference to go to 2 and then back to
1, not destroying it.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@38739 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/buffer/evas_engine.c

index 1f9e611..bb8f535 100644 (file)
@@ -135,8 +135,6 @@ eng_setup(Evas *e, void *in)
    Evas_Engine_Info_Buffer *info;
 
    info = (Evas_Engine_Info_Buffer *)in;
-   if (e->engine.data.output)
-     eng_output_free(e->engine.data.output);
    re = _output_setup(e->output.w,
                      e->output.h,
                      info->info.dest_buffer,
@@ -149,6 +147,8 @@ eng_setup(Evas *e, void *in)
                      info->info.color_key_b,
                      info->info.func.new_update_region,
                      info->info.func.free_update_region);
+   if (e->engine.data.output)
+     eng_output_free(e->engine.data.output);
    e->engine.data.output = re;
    if (!e->engine.data.output) return;
    if (!e->engine.data.context)