<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">&lt;<a href="mailto:otte@gnome.org">otte@gnome.org</a>&gt;</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&#39;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 &lt;<a href="mailto:zoulunkai@gmail.com">zoulunkai@gmail.com</a>&gt; wrote:<br>&gt; Hello,<br>&gt;<br>&gt; I got a question about the script function class(SwfdecAsScriptFunction)<br>
&gt; design in swfdec.<br>&gt;<br>&gt; Why doesn&#39;t a script function mark its<br>&gt; target(SwfdecAsScriptFunction::target) in the marking phase?  What if the<br>&gt; function&#39;s target has been destroyed while the function itself is still kept<br>
&gt; alive? (Answer myself: then there would be  a segfault when executing that<br>&gt; function)<br>&gt;<br>&gt; Let me give a more specific case:<br>&gt;<br>&gt; (1)swf(movie) &#39;A&#39; defines a script function  &#39;movie_a_func()&#39; inside its<br>
&gt; body.<br>&gt; (2)swf(movie) &#39;B&#39; loads  movie &#39;A&#39; at runtime by using loadMovieNum(&#39;A.swf&#39;,<br>&gt; 2);<br>&gt; (3)movie &#39;B&#39; then create a reference to function &#39;movie_a_func()&#39; , eg.<br>
&gt; movie_b_func = _level2.movie_a_func;<br>&gt; (4)unload movie &#39;A&#39; by using _level2.unloadMovie();<br>&gt; (5)next frame;  //Note target of  &#39;&#39;movie_a_func&#39;, which is &#39;A&#39; is destroyed<br>&gt; and collected here.<br>
&gt; (6)call function  &#39;movie_b_func&#39;;  // bomb, trying to reference its<br>&gt; target(movie A) that is already freed.<br>&gt;<br>&gt; The above case could happen more easily when set GC threshold to zero(alway<br>
&gt; gc).<br>&gt;<br>&gt; The obvious fix to me is always marking the target of a script function, but<br>&gt; I am not 100% sure if it&#39;s the right way.  It would be helpful if anyone<br>&gt; could confirm with me. (BTW, I&#39;v made the real tests described as above.)<br>
&gt;<br>&gt; Yes, I&#39;ll file a bug if get confirmed or at least there is someone<br>&gt; concerning this mail.<br>&gt;<br>&gt;<br>&gt; --zou<br>&gt;<br>&gt;<br>&gt;<br></div></div></blockquote></div><br>