[Wxruby-development] [1136] trunk/wxruby2/swig/classes/App.i: Note when the Wx::App is exiting and avoid doing GC if in process of

nobody at rubyforge.org
2007-07-21T16:42:13Z

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<meta http-equiv="content-type"
content="text/html; charset=utf-8" /><style
type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:'':'';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family:
verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;
font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding:
6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid;
padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family:
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch
.binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
-->
[1136] trunk/wxruby2/swig/classes/App.i: Note when the Wx::App is
exiting and avoid doing GC if in process of





Revision 1136
Author brokentoy
Date 2007-07-21 12:42:13 -0400 (Sat, 21 Jul
2007)


Log Message
Note when the Wx::App is exiting and avoid doing GC if in process of
doing so

Modified Paths

<a
href="#trunkwxruby2swigclassesAppi">trunk/wxruby2/swig/classes/App.i




Diff

Modified:
trunk/wxruby2/swig/classes/App.i (1135 => 1136)

---
trunk/wxruby2/swig/classes/App.i&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp2007-07-21
15:52:16 UTC (rev 1135)
+++
trunk/wxruby2/swig/classes/App.i&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp2007-07-21
16:42:13 UTC (rev 1136)
@@ -68,8 +68,7 @@

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspGC_SetWindowDeleted(wx_obj);

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspevent.Skip();
}
-
-
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
static VALUE mark_iterate(VALUE
pair, VALUE arg, VALUE self)
{

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE
key, val;
@@ -77,13 +76,12 @@

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspkey =
rb_ary_entry(pair, 0);

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspval =
rb_ary_entry(pair, 1);

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE
rb_obj = SWIG_RubyReferenceToObject(val);
-

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// Check
if it''s a valid object (sometimes SWIG doesn''t return what
we''re

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp//
expecting), a descendant of Wx::Window, and if it has not yet been

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp//
deleted by WxWidgets; if so, mark it.

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif (
TYPE(rb_obj) == T_DATA &&

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
rb_obj_is_kind_of(rb_obj, cWxWindow.klass) &&
-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
rb_iv_get(rb_obj, "@__wx_destroyed__") != Qtrue )
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
! rb_ivar_defined(rb_obj, rb_intern("@__wx_destroyed__") ) )

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  {

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_gc_mark(rb_obj);

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  }
@@ -105,9 +103,9 @@

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp//
errors.

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE
the_app = rb_const_get(mWxruby2, rb_intern("THE_APP"));

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif (
DATA_PTR(the_app) == 0 )
-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
{
-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn;
-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  }
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
return;
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif (
rb_iv_get(the_app, "__app_ended__") == Qtrue )
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
return;


&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// To do
the marking, iterate over SWIG''s hash list of known wrapped

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp//
objects (swig_ruby_trackings) and check each one.
@@ -177,6 +175,9 @@
#ifdef
__WXDEBUG__&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

printf("OnExit...\n");
#endif
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE
the_app = rb_const_get(mWxruby2, rb_intern("THE_APP"));
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_iv_set(the_app,
"__app_ended__", Qtrue);
+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
wxLog *oldlog =
wxLog::SetActiveTarget(new wxLogStderr);
SetTopWindow(0);
if ( oldlog )