<div>see attached files, the two files should be placed in the same directory.</div>
<div> </div>
<div>A: functions.swf</div>
<div>B: movieLoader.swf</div>
<div> </div>
<div>--zou</div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Thu, Mar 5, 2009 at 4:19 PM, Benjamin Otte <span dir="ltr"><<a href="mailto:otte@gnome.org">otte@gnome.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">That indeed looks like an oversight. You said you have a testcase for<br>this that we can add to the testsuite?<br>
Could you send that here, so I don't have to code it?<br><br>Cheers,<br><font color="#888888">Benjamin<br></font>
<div>
<div></div>
<div class="h5"><br><br>On Thu, Mar 5, 2009 at 3:17 AM, zou lunkai <<a href="mailto:zoulunkai@gmail.com">zoulunkai@gmail.com</a>> wrote:<br>> Hello,<br>><br>> I got a question about the script function class(SwfdecAsScriptFunction)<br>
> design in swfdec.<br>><br>> Why doesn't a script function mark its<br>> target(SwfdecAsScriptFunction::target) in the marking phase? What if the<br>> function's target has been destroyed while the function itself is still kept<br>
> alive? (Answer myself: then there would be a segfault when executing that<br>> function)<br>><br>> Let me give a more specific case:<br>><br>> (1)swf(movie) 'A' defines a script function 'movie_a_func()' inside its<br>
> body.<br>> (2)swf(movie) 'B' loads movie 'A' at runtime by using loadMovieNum('A.swf',<br>> 2);<br>> (3)movie 'B' then create a reference to function 'movie_a_func()' , eg.<br>
> movie_b_func = _level2.movie_a_func;<br>> (4)unload movie 'A' by using _level2.unloadMovie();<br>> (5)next frame; //Note target of ''movie_a_func', which is 'A' is destroyed<br>> and collected here.<br>
> (6)call function 'movie_b_func'; // bomb, trying to reference its<br>> target(movie A) that is already freed.<br>><br>> The above case could happen more easily when set GC threshold to zero(alway<br>
> gc).<br>><br>> The obvious fix to me is always marking the target of a script function, but<br>> I am not 100% sure if it's the right way. It would be helpful if anyone<br>> could confirm with me. (BTW, I'v made the real tests described as above.)<br>
><br>> Yes, I'll file a bug if get confirmed or at least there is someone<br>> concerning this mail.<br>><br>><br>> --zou<br>><br>><br>><br></div></div></blockquote></div><br>