liujianli wrote: > Hi Christian, > > Thanks for your reply very much! > > >> I do not know this code but if I look at the loop there is an >> event removed from maEvents each time, so naturally maEvents >> should run empty sooner or later. What must happen now to make >> this an endless loop is that event.pEvent->fire() later on >> pushes more events to maEvents which also create more events. >> >> It looks ok for me that firing an event can cause creation >> of another event so in this case it might be that the >> endless loop is actually correct since there may be always >> something to do. >> > > Yes ,you are right,but I think that we still should change the operator into > <. > The following is my understanding: > First,we must get what has happened inside event.pEvent->fire(). > I found that it will get the timeout and makeInterruptableDelay,you can catch > it in the void > SlideShowImpl::notifySlideAnimationsEnded()(slideshow\source\engine\slideshowimpl.cxx),queryAutomaticSlideTransition() > will obtain the timeout.please notice > makeInterruptableDelay()(slideshow\source\inc\interruptabledelayevent.hxx),it > will set the TimeoutEvent according to timeout,and then the event will be add > into maEvents. > In notifySlideAnimationsEnded there is an event placed in the event queue that signals that the slide should be changed, in case where we have a slideshow that switches slides automatically and does not wait for the user to click. A timeout of 0 means the slide should be switched as soon as the slide animations have ended. So far this looks ok.
The question is, why is this causing a loop? I do not think that the notifySlideEnded again fires a notifySlideEnded event? Or does it fire a notifySlideAnimationsEnded() for the same slide again? > I think the point is how to construct EventEntry,the second parameter > indicates the time which is made up of timeout and ElapsedTime,actually I > don't understand very much about the ElapseTime. > ElapsedTime should be the time that has elapsed until now. So it is the time from the beginning of the slideshow if you will (minus the time the slide show spend in pause mode). If something has to happen in timout seconds, you get the absolute time in slideshow timezone when you calculate ElapsedTime + timeout. If timeout is 0 it means this event should happen right now, which can be ok. > OK,now we will get back to the while loop again. > Let's reconsider this condition,the maEvents's time is made up of timeout and > ElapsedTime,and then it will compare with ElapsedTime. > If the timeout is set to 5,it will be ok,but if the timeout is set to 0,well > then,what will happen? > I think we should change the operator into < or catch the timeout if it is > 0,and then set the value to 0.001. > How do you think? > I still do not think this is the solution, you want to handle all events that should be fired now. And that are all where the actual time has already passed (< ElapsedTime) but also the ones that should be fired right now (= ElapsedTime) So the question still is, why is there a loop? Which event fires a sequence of events that repeat them self with a timeout of 0. And if we found it we must decide if this is an error or a valid use case. Additionally we should make the event loop save by using a copy of the event queue, as outlined in my last mail. Regards, Christian > BestRegards, > > LiuJianli > ------------------------------------ > RedFlag Chinese2000 Software Co.Ltd. > [EMAIL PROTECTED] > > -- Sun Microsystems GmbH Sonnenallee 1, D-85551 Kirchheim-Heimstetten Sitz der Gesellschaft: Sonnenallee 1, D-85551 Kirchheim-Heimstetten Amtsgericht München: HRB 161028 Gescha"ftsführer: Thomas Schro"der, Wolfgang Engels, Dr. Roland Bo"mer Vorsitzender des Aufsichtsrates: Martin Ha"ring --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
