On Fri, 9 Dec 2011 14:12:35 -0200 Paulo Benatto <bena...@gmail.com> said:

ok - the problem isn't in the code you pasted. the problem is much much much
more subtle. to fix it you need to understand exactly why it's complaining that
the object is "unstable" during recalc, and the reason that it is unstable is a
result of many subtle properties and factors that may be a result of layout of
the whole gui or may other things. so here goes:

when things change with smart objects. they queue things and set a changed
flag. this queue of objects to "recalc" isn't normally recalculated until just
before rendering. this avoids excessive object manipulations and
re-calculations by deferring them until the last possible moment.

now remember that we also have a tree of objects. parents (smart objects) can
manipulate children (either more smart objects or plain objects). if a child is
a smart object.. when the parent manipulates it as part of its "calculation"
for getting its display geometry right, this object will also be queued (at the
end of the queue). eventually when evas gets to this object in the queue, it
also will be calculated, and so-on.

so let's imaging we have a box A, with 3 children, B, C and D. first our queue
starts off as:

A

so we process out queue of 1. while doing A it positions/sizes B, C and D and
so they get queued, sp we have:

A.BCD

where '.' is the current position in the queue we are at. now the queue keeps
going and B, C and D are positions/sized. but WHILE sizing C, C changes its
sizing hints (that affect how the box A will lay out children). if C has sizing
based on aspect ratio, this is common, because height can depend on width, or
width can depend on height. this change in sizing hits is captured by the
parent box "A" and thus A re-queues itself to be calculated as now a child
changed its sizing hints:

A.BCD
AB.CD
ABC.DA

then we march on...
ABCD.A

and when processing A - the 3 children get re-laid-out again:

ABCDA.BCD

this time around we hope that things remain "stable" and the children take
their given geometry without "arguing" about it.

ABCDABC.D

But let's say now D is unhappy and changes its size hints... we repeat:

ABCDABCD.A

and then..

ABCDABCDA.BCD

you get the idea... this is necessary as this kind of queue in effect acts as a
negotiation mechanism where parent lays out children based on current
information about child geometry preferences (min/max/align/weight) and child
gets laid out then it also has a chance to disagree and change its mind
(change its hints). technically this could continue ad-infinitum. this would be
a problem as then your app would come to a complete halt in an infinite loop
(and depending if we remove queue items as we process them or not) maybe
consume all available memory until it crashes. thus we have placed a limit on
the number of times an object can be re-queued during computation (well the
number of times its calculate function can be called during this cycle). every
object keeps a count of this and when this exceeds a given value (currrent
limit is 255) then evas disallows the object to be  re-queued for computation
and emits the complaint above. this is the detailed version of what it says
when the object is "unstable". it could be something like this:

box: ok child you will now be 100x100
child: no.. i want to be at least 200x100
box: ok. well given that size, and all items are meant to be square (not an
actual feature of box, but for example only), then you must be 200x200
child: 200x200? that's not 200x100. i don't like that. i want to be 100x100
box: ok then be 100x100
child: no.. i want to be at least 200x100...

you get the idea - this kind of "bickering" can loop forever unless on e side
at some point settles down and stops disagreeing. the only way you can begin to
find out who is at fault is to find out what object is unstable and then what
objects are its children or parents and find out their interactions and find a
way to settle the argument long before evas loses its patience and settles the
argument for you (which is also why you find odd layout at times as
calculations simply were never completed).

unfortunately we don't really have any better tools for you - the best we could
provide would be a complete dump of the calculation queue/list and maybe a
backtrace for each item that was added (what call stack got the item to bee
added to the queue). even that my not really help that much. :) but we have
nothing like that for you at the moment, so it's "manually figure it out but
following the arguments". :)

> Hi all,
> 
> I'm here again asking some tips =). I've a problem with this warning
> "evas_object_smart_need_recalculate_set() Object 0x170c024 is not stable
> during recalc loop". I know what is the problem, but I don't know how I can
> fix it =/. I'm developing an IP phone, and during a established call I've a
> counter time, to time the duration of the call and all the time I update it
> (each second).
> Because this counter time, appears a lot of warning to me, and sometimes my
> counter time changes the position in my screen =), like a sliding!
> 
> Actually, I would like a tip, How is the better way to do this counter time?
> Why my counter time is sliding in my screen?
> 
> Bellow, there is an example!
> 
> /* SET Counter Time */
> void
> tg_call_window_set_duration(TgCallWindow *win, double duration)
> {
>     char* str_duration = tg_util_get_duration(duration);
>     if (!win) {
>         EINA_LOG_ERR("win is NULL");
>         return;
>     }
>     elm_object_text_part_set(win->layout, "elm.text.duration",
> str_duration);
>     free(str_duration);
> }
> 
> /* START Counter Time */
> 
> void
> tg_call_control_start_duration()
> {
>     tg_call_control_stop_duration();
>     time(&start_duration);
>     stop_duration = start_duration;
>     tg_call_window_set_duration(window, 0);
>     update_duration_timer = ecore_timer_add(1.0, _update_duration_cb, NULL);
> }
> 
> /* Callback */
> 
> static Eina_Bool
> _update_duration_cb(void *data)
> {
>     UNUSED(data);
>     double duration = tg_call_control_get_duration();
> 
>     if (!window) {
>         EINA_LOG_ERR("window is NULL");
> 
>         return EINA_FALSE;
>     }
>     tg_call_window_set_duration(window, duration);
> 
>     return EINA_TRUE;
> }
> 
> /* GET duration */
> char *
> tg_util_get_duration(double duration)
> {
>     int hours, minutes, seconds;
>     char buf[11];
> 
>     hours = (int) (duration / 3600.0);
>     duration -= hours * 3600;
>     minutes = (int) (duration / 60);
>     duration -= minutes * 60;
>     seconds = duration;
>     snprintf(buf, sizeof(buf), "%02d:%02d:%02d", hours, minutes, seconds);
> 
>     return strdup(buf);
> }
> 
> 
> /* EDC part */
> 
>   part { name: "elm.text.duration";
>       type: TEXT;
>       effect: SHADOW;
>       description {
>         state: "default" 0.0;
>         text {
>           font: "normal";
>           size: 15;
>           text: "00:00:00";
>         }
>         align: 0.0 0.0;
>         color: 254 254 254 255;
>         rel1.to: "called_off";
>         rel1.offset: -20 23;
>       }
>     }
> 
> 
> Regards,
> 
> 
> 
> 
> -- 
> Paulo Leonardo Benatto, patito
> "the fear of being free, makes you proud of being a slave"
> ------------------------------------------------------------------------------
> Cloud Services Checklist: Pricing and Packaging Optimization
> This white paper is intended to serve as a reference, checklist and point of 
> discussion for anyone considering optimizing the pricing and packaging model 
> of a cloud services business. Read Now!
> http://www.accelacomm.com/jaw/sfnl/114/51491232/
> _______________________________________________
> 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


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to