<div dir="ltr"><div>Hi Ricky,<br><br></div><div>I don't know what is in your event callback but for exit to cause a crash it sounds like something is probably not being managed robustly. As I know so little I can't provide any specific advice.<br><br></div><div>One possibility might be to call viewer.eventTravseral() after the main rendering loop. I can't help be feel there is something amiss in the way your are managing your event callback and it's associated faculties, and suspect a small redesign could probably resolve the issue. <br></div><div><br></div><div>Robert.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 October 2015 at 18:03, Riccardo Corsi <span dir="ltr"><<a href="mailto:riccardo.corsi@kairos3d.it" target="_blank">riccardo.corsi@kairos3d.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi all,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I have an event callback which needed to be called before some custom code I call in the main application loop, something like:</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">while()</div><div class="gmail_default" style="font-family:tahoma,sans-serif">{</div><div class="gmail_default" style="font-family:tahoma,sans-serif">viewer.eventTraversal(); // << needed callback here<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">// custom code</div><div class="gmail_default" style="font-family:tahoma,sans-serif">// prepare stuff to be drawn during next frames</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">viewer.updateTraversal();</div><div class="gmail_default" style="font-family:tahoma,sans-serif">// ...</div><div class="gmail_default" style="font-family:tahoma,sans-serif">}</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">When the viewer is about to exit, the event callbacks are not called.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">In my case the callback is needed instead, </div><div class="gmail_default" style="font-family:tahoma,sans-serif">not to cause a segfault to the custom code between osg calls.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">The obvious solution is to place the callback directly in the main loop,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">but I'd like to avoid that</div><div class="gmail_default" style="font-family:tahoma,sans-serif">(to keep it more "transparent", as it's a kind of framework to be used in several applications).</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Have you got any suggestion?</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you!</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Ricky</div></div>
<br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>