nobody at rubyforge.org
2007-Jul-21 16:42 UTC
[Wxruby-development] [1136] trunk/wxruby2/swig/classes/App.i: Note when the Wx::App is exiting and avoid doing GC if in process of
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><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;}
--></style>
<title>[1136] trunk/wxruby2/swig/classes/App.i: Note when the Wx::App is
exiting and avoid doing GC if in process of</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1136</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2007-07-21 12:42:13 -0400 (Sat, 21 Jul
2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Note when the Wx::App is exiting and avoid doing GC if in process of
doing so</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxruby2swigclassesAppi">trunk/wxruby2/swig/classes/App.i</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxruby2swigclassesAppi"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/swig/classes/App.i (1135 => 1136)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/swig/classes/App.i        2007-07-21
15:52:16 UTC (rev 1135)
+++
trunk/wxruby2/swig/classes/App.i        2007-07-21
16:42:13 UTC (rev 1136)
</span><span class="lines">@@ -68,8 +68,7 @@
</span><span class="cx">
        GC_SetWindowDeleted(wx_obj);
</span><span class="cx">
        event.Skip();
</span><span class="cx"> }
</span><del>-
-
</del><ins>+        
</ins><span class="cx"> static VALUE mark_iterate(VALUE
pair, VALUE arg, VALUE self)
</span><span class="cx"> {
</span><span class="cx">
        VALUE
key, val;
</span><span class="lines">@@ -77,13 +76,12 @@
</span><span class="cx">
        key =
rb_ary_entry(pair, 0);
</span><span class="cx">
        val =
rb_ary_entry(pair, 1);
</span><span class="cx">
        VALUE
rb_obj = SWIG_RubyReferenceToObject(val);
</span><del>-
</del><span class="cx">
        // Check
if it''s a valid object (sometimes SWIG doesn''t return what
we''re
</span><span class="cx">
        //
expecting), a descendant of Wx::Window, and if it has not yet been
</span><span class="cx">
        //
deleted by WxWidgets; if so, mark it.
</span><span class="cx">
        if (
TYPE(rb_obj) == T_DATA &&
</span><span class="cx">
                
rb_obj_is_kind_of(rb_obj, cWxWindow.klass) &&
</span><del>-                
rb_iv_get(rb_obj, "@__wx_destroyed__") != Qtrue )
</del><ins>+                
! rb_ivar_defined(rb_obj, rb_intern("@__wx_destroyed__") ) )
</ins><span class="cx">
         {
</span><span class="cx">
                rb_gc_mark(rb_obj);
</span><span class="cx">
         }
</span><span class="lines">@@ -105,9 +103,9 @@
</span><span class="cx">
        //
errors.
</span><span class="cx">
        VALUE
the_app = rb_const_get(mWxruby2, rb_intern("THE_APP"));
</span><span class="cx">
        if (
DATA_PTR(the_app) == 0 )
</span><del>-        
{
-                return;
-         }
</del><ins>+        
return;
+        if (
rb_iv_get(the_app, "__app_ended__") == Qtrue )
+        
return;
</ins><span class="cx">
</span><span class="cx">
        // To do
the marking, iterate over SWIG''s hash list of known wrapped
</span><span class="cx">
        //
objects (swig_ruby_trackings) and check each one.
</span><span class="lines">@@ -177,6 +175,9 @@
</span><span class="cx"> #ifdef
__WXDEBUG__        
</span><span class="cx">
printf("OnExit...\n");
</span><span class="cx"> #endif
</span><ins>+                VALUE
the_app = rb_const_get(mWxruby2, rb_intern("THE_APP"));
+                rb_iv_set(the_app,
"__app_ended__", Qtrue);
+                                        
</ins><span class="cx"> wxLog *oldlog =
wxLog::SetActiveTarget(new wxLogStderr);
</span><span class="cx"> SetTopWindow(0);
</span><span class="cx"> if ( oldlog )
</span></span></pre>
</div>
</div>
</body>
</html>
Possibly Parallel Threads
- [1022] trunk/wxruby2/swig/classes/App.i: Memory mgmt: use Wx::App to mark still-alive Windows, set up Wx::THE_APP const
- [1028] trunk/wxruby2/swig/classes/App.i: Fix some GC-mark crashes when SWIG trackings return an unexpected object
- [1026] trunk/wxruby2/swig/shared/control_with_items.i: Memory mgmt: USe __wx_destroyed__ instead of __swig_dead__; fix some
- [722] trunk/wxruby2/swig: Wx::Choice fixes for get_client_data (AF)
- [1125] trunk/wxruby2/swig/shared/control_with_items.i: Avoid MSW crashes when unexpected object is returned by SWIG tracking
