On Mon, 5 Aug 2013 12:41:44 +0900 Daniel Juyung Seo <seojuyu...@gmail.com> said:

> But examples in elementary also does the same thing.
> http://git.enlightenment.org/core/elementary.git/tree/src/examples/thumb_example_01.c

as i explained on irc already. the examples are wrong for several reasons.

1. setting ethumb settings globally ignores the fact that many em_thumb
widgets and other users of ethumb will want different thumb generation params.
eg one elm_thumb widget needs 256x256 thumbs, another 32x32 thumbs. these
should have been part of the elm_thumb widget itself and set just before
the thumbnail request.

2. ethumbd always has been able to timeout or crash. in that case you'd lose
your connection and your thumb params and elm_thumb would reconnect having lost
your info. without passing such info to elm_thumb its not possible to make it
work right.

3. even if you listen to the elm thumb connect event you are too late - a thumb
request will be sent off already so any params you change are wrong there.

4. elm thumb's behavior was to ALWAYS start an ethumb instance if you use it or
not. this means also that it always re-started it if it quit (so there was
always a race condition where you could have had an exited ethumb connection
you configured just before a restart), but this means you could NEVER kill
ethumbd - ever. it kept staying around and being restarted all the time, all
day, if you needed it or not. ethumbd has always had a timeout ability and was
designed to be able to, but it was never turned on by default. it is on now by
default and thus elm_thumb's behavior cause ethumbd to start on app startup
(extra overhead) AND it caused it to be unkillable as elm apps would keep
restarting it.

so the examples were "wrong" to begin with anyway. :)


> Daniel Juyung Seo (SeoZ)
> 
> 
> On Mon, Aug 5, 2013 at 12:26 PM, Carsten Haitzler <ras...@rasterman.com>wrote:
> 
> > On Mon, 5 Aug 2013 11:19:27 +0900 Daniel Juyung Seo <seojuyu...@gmail.com>
> > said:
> >
> > badness on ephoto's part to assume ethumb client must be connected at all
> > times
> > and to assume ethumb client settings survive - eg ethumbd timeouts. :)
> >
> > > Hello, raster can you check this commit again?
> > >
> > > It broke existing ethumb sample/apps.
> > >
> > http://git.enlightenment.org/core/elementary.git/tree/src/examples/thumb_example_01.c
> > > This thumb example is broken after this commit and ephoto is not running
> > > due to this patch.
> > >
> > > Thanks in advance.
> > >
> > > Daniel Juyung Seo (SeoZ)
> > >
> > >
> > >
> > > On Thu, Jul 4, 2013 at 8:39 AM, Carsten Haitzler - Enlightenment Git <
> > > no-re...@enlightenment.org> wrote:
> > >
> > > > raster pushed a commit to branch master.
> > > >
> > > > commit 433a2c805ff768c08e6fa87c4e5e66466b3685b0
> > > > Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
> > > > Date:   Thu Jul 4 08:39:00 2013 +0900
> > > >
> > > >     ethumb - stop requesting ethumbd to start again every time it dies
> > > > ---
> > > >  src/lib/elm_icon.c  | 11 ++++----
> > > >  src/lib/elm_thumb.c | 76
> > > > ++++++++++++++++++++++++++++-------------------------
> > > >  2 files changed, 45 insertions(+), 42 deletions(-)
> > > >
> > > > diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c
> > > > index 16b067a..652d384 100644
> > > > --- a/src/lib/elm_icon.c
> > > > +++ b/src/lib/elm_icon.c
> > > > @@ -620,17 +620,16 @@ _elm_icon_smart_add(Eo *obj, void *_pd, va_list
> > > > *list EINA_UNUSED)
> > > >  static void
> > > >  _elm_icon_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
> > > >  {
> > > > -#ifdef HAVE_ELEMENTARY_ETHUMB
> > > > -   Ethumb_Client *ethumbd;
> > > > -#endif
> > > > -
> > > >     Elm_Icon_Smart_Data *sd = _pd;
> > > >
> > > >     if (sd->stdicon) eina_stringshare_del(sd->stdicon);
> > > >
> > > >  #ifdef HAVE_ELEMENTARY_ETHUMB
> > > > -   ethumbd = elm_thumb_ethumb_client_get();
> > > > -   _icon_thumb_stop(sd, ethumbd);
> > > > +   if (sd->thumb.request)
> > > > +     {
> > > > +        Ethumb_Client *ethumbd = elm_thumb_ethumb_client_get();
> > > > +        if (ethumbd) _icon_thumb_stop(sd, ethumbd);
> > > > +     }
> > > >
> > > >     eina_stringshare_del(sd->thumb.file.path);
> > > >     eina_stringshare_del(sd->thumb.file.key);
> > > > diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
> > > > index 906fae5..d615009 100644
> > > > --- a/src/lib/elm_thumb.c
> > > > +++ b/src/lib/elm_thumb.c
> > > > @@ -404,13 +404,47 @@ _thumbnailing_available_cb(void *data,
> > > >     return ECORE_CALLBACK_RENEW;
> > > >  }
> > > >
> > > > +static Eina_Bool _elm_need_ethumb = EINA_FALSE;
> > > > +static void _on_die_cb(void *, Ethumb_Client *);
> > > > +
> > > > +static void
> > > > +_connect_cb(void *data __UNUSED__,
> > > > +            Ethumb_Client *c,
> > > > +            Eina_Bool success)
> > > > +{
> > > > +   if (success)
> > > > +     {
> > > > +        ethumb_client_on_server_die_callback_set(c, _on_die_cb, NULL,
> > > > NULL);
> > > > +        _elm_ethumb_connected = EINA_TRUE;
> > > > +        ecore_event_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, NULL, NULL,
> > NULL);
> > > > +     }
> > > > +   else
> > > > +     _elm_ethumb_client = NULL;
> > > > +}
> > > > +
> > > > +static void
> > > > +_on_die_cb(void *data __UNUSED__,
> > > > +           Ethumb_Client *c __UNUSED__)
> > > > +{
> > > > +   if (_elm_ethumb_client)
> > > > +     {
> > > > +        ethumb_client_disconnect(_elm_ethumb_client);
> > > > +        _elm_ethumb_client = NULL;
> > > > +     }
> > > > +   _elm_ethumb_connected = EINA_FALSE;
> > > > +   if (pending_request > 0)
> > > > +     _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL,
> > NULL);
> > > > +}
> > > > +
> > > >  static void
> > > >  _thumb_show(Elm_Thumb_Smart_Data *sd)
> > > >  {
> > > >     Elm_Widget_Smart_Data *wd = eo_data_scope_get(sd->obj,
> > > > ELM_OBJ_WIDGET_CLASS);
> > > >     evas_object_show(wd->resize_obj);
> > > >
> > > > -   if (elm_thumb_ethumb_client_connected_get())
> > > > +   if (!_elm_ethumb_client)
> > > > +     _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL,
> > NULL);
> > > > +   else if (elm_thumb_ethumb_client_connected_get())
> > > >       {
> > > >          _thumb_start(sd);
> > > >          return;
> > > > @@ -474,38 +508,6 @@ _elm_thumb_smart_hide(Eo *obj, void *_pd, va_list
> > > > *list EINA_UNUSED)
> > > >  #endif
> > > >  }
> > > >
> > > > -#ifdef ELM_ETHUMB
> > > > -static Eina_Bool _elm_need_ethumb = EINA_FALSE;
> > > > -static void _on_die_cb(void *, Ethumb_Client *);
> > > > -
> > > > -static void
> > > > -_connect_cb(void *data __UNUSED__,
> > > > -            Ethumb_Client *c,
> > > > -            Eina_Bool success)
> > > > -{
> > > > -   if (success)
> > > > -     {
> > > > -        ethumb_client_on_server_die_callback_set(c, _on_die_cb, NULL,
> > > > NULL);
> > > > -        _elm_ethumb_connected = EINA_TRUE;
> > > > -        ecore_event_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, NULL, NULL,
> > NULL);
> > > > -     }
> > > > -   else
> > > > -     _elm_ethumb_client = NULL;
> > > > -}
> > > > -
> > > > -static void
> > > > -_on_die_cb(void *data __UNUSED__,
> > > > -           Ethumb_Client *c __UNUSED__)
> > > > -{
> > > > -   ethumb_client_disconnect(_elm_ethumb_client);
> > > > -
> > > > -   _elm_ethumb_client = NULL;
> > > > -   _elm_ethumb_connected = EINA_FALSE;
> > > > -   _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL,
> > NULL);
> > > > -}
> > > > -
> > > > -#endif
> > > > -
> > > >  void
> > > >  _elm_unneed_ethumb(void)
> > > >  {
> > > > @@ -513,8 +515,11 @@ _elm_unneed_ethumb(void)
> > > >     if (!_elm_need_ethumb) return;
> > > >     _elm_need_ethumb = EINA_FALSE;
> > > >
> > > > -   ethumb_client_disconnect(_elm_ethumb_client);
> > > > -   _elm_ethumb_client = NULL;
> > > > +   if (_elm_ethumb_client)
> > > > +     {
> > > > +        ethumb_client_disconnect(_elm_ethumb_client);
> > > > +        _elm_ethumb_client = NULL;
> > > > +     }
> > > >     ethumb_client_shutdown();
> > > >     ELM_ECORE_EVENT_ETHUMB_CONNECT = 0;
> > > >  #endif
> > > > @@ -561,7 +566,6 @@ elm_need_ethumb(void)
> > > >
> > > >     ELM_ECORE_EVENT_ETHUMB_CONNECT = ecore_event_type_new();
> > > >     ethumb_client_init();
> > > > -   _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL,
> > NULL);
> > > >
> > > >     return EINA_TRUE;
> > > >  #else
> > > >
> > > > --
> > > >
> > > >
> > > >
> > ------------------------------------------------------------------------------
> > > > This SF.net email is sponsored by Windows:
> > > >
> > > > Build for Windows Store.
> > > >
> > > > http://p.sf.net/sfu/windows-dev2dev
> > > >
> > >
> > ------------------------------------------------------------------------------
> > > Get your SQL database under version control now!
> > > Version control is standard for application code, but databases havent
> > > caught up. So what steps can you take to put your SQL databases under
> > > version control? Why should you start doing it? Read more to find out.
> > >
> > http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > enlightenment-devel mailing list
> > > enlightenment-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > >
> >
> >
> > --
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> > The Rasterman (Carsten Haitzler)    ras...@rasterman.com
> >
> >


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to