Displaying 14 results from an estimated 14 matches for "__wx_destroyed__".
2007 May 21
0
[1026] trunk/wxruby2/swig/shared/control_with_items.i: Memory mgmt: USe __wx_destroyed__ instead of __swig_dead__; fix some
...round:#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>[1026] trunk/wxruby2/swig/shared/control_with_items.i: Memory mgmt: USe __wx_destroyed__ instead of __swig_dead__; fix some</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1026</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2007-05-21 14:40:49 -0400 (Mo...
2007 May 21
13
First drop of new memory management
Hi
Just a quick update on memory leaks etc. I''ve just dropped a bunch of
patches with a new approach to linking ruby''s GC to Wx''s memory
handling. Still some work to do - eg bigdemo.rb falls over quite quickly
- but working well for me on other samples.
Briefly, it disposes of fixdeleting. For almost all objects that aren''t
Windows, they should now be
2007 Jul 21
0
[1136] trunk/wxruby2/swig/classes/App.i: Note when the Wx::App is exiting and avoid doing GC if in process of
...nbsp      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"...
2007 Jul 05
0
[1109] trunk/wxruby2/swig: Move marking of MenuBar from direct %markfunc to via mark_wxFrame, so
...nbsp   // SWIG_RubyUnlinkObjects((void *)wx_obj);
-
-        VALUE rb_obj = SWIG_RubyInstanceFor((void *)wx_obj);
-        rb_iv_set(rb_obj, "@__wx_destroyed__", Qtrue);
</del><ins>+        GC_SetWindowDeleted(wx_obj);
</ins><span class="cx">         event.Skip();
</span><span class...
2007 May 21
0
[1022] trunk/wxruby2/swig/classes/App.i: Memory mgmt: use Wx::App to mark still-alive Windows, set up Wx::THE_APP const
...nbsp   // SWIG_RubyUnlinkObjects((void *)wx_obj);
+
+        VALUE rb_obj = SWIG_RubyInstanceFor((void *)wx_obj);
+        rb_iv_set(rb_obj, "@__wx_destroyed__", Qtrue);
+        event.Skip();
+ }
+
+
+ static VALUE mark_iterate(VALUE pair, VALUE arg, VALUE self)
+ {
+        VALUE key, val;
+
+  &nbs...
2007 Jul 21
0
[1135] trunk/wxruby2/swig/mark_free_impl.i: Convert from DOS to Unix newlines
..._impl.i - this contains the C++ implementation of various
-// common GC-related functions, such as shared %mark functions and
-// methods for checking and setting whether a wxWidgets window has been
-// destroyed. It is compiled into wx.cpp.
-
-
-%{
-static VALUE wx_destroyed_sym = rb_intern("@__wx_destroyed__");
-
-// Code to be run when the ruby object is swept by GC - this only
-// unlinks the C++ object from the ruby VALUE but doesn''t delete
-// it because it is still needed and will be managed by WxWidgets.
-void GcNullFreeFunc(void *ptr)
-{
- SWIG_RubyRemoveTracking(ptr);
-}
-
-// Te...
2007 Jul 21
0
[1127] trunk/wxruby2: Move shared C++ GC functions into separate file included into wx.i
..._impl.i - this contains the C++ implementation of various
+// common GC-related functions, such as shared %mark functions and
+// methods for checking and setting whether a wxWidgets window has been
+// destroyed. It is compiled into wx.cpp.
+
+
+%{
+static VALUE wx_destroyed_sym = rb_intern("@__wx_destroyed__");
+
+// Code to be run when the ruby object is swept by GC - this only
+// unlinks the C++ object from the ruby VALUE but doesn''t delete
+// it because it is still needed and will be managed by WxWidgets.
+void GcNullFreeFunc(void *ptr)
+{
+ SWIG_RubyRemoveTracking(ptr);
+}
+
+// Te...
2007 Jul 21
0
[1137] trunk/wxruby2/swig/classes/TreeCtrl.i: Call correct shared function to check whether TreeCtrl is deleted in markfunc
...*ptr)
</span><span class="cx"> {
</span><del>-        VALUE rb_obj = SWIG_RubyInstanceFor(ptr);
-        if ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue )
</del><ins>+        if ( GC_IsWindowDeleted(ptr) )
</ins><span class="cx">          return;
</span><span cla...
2007 Jul 20
0
[1125] trunk/wxruby2/swig/shared/control_with_items.i: Avoid MSW crashes when unexpected object is returned by SWIG tracking
...gt;<span class="cx">         VALUE rb_obj = SWIG_RubyInstanceFor(ptr);
</span><span class="cx">         if ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue )
</span><span class="cx">          return;
</span><del>-        fflush(stdout);
-    &...
2007 Jul 21
0
[1133] trunk/wxruby2/swig/shared/control_with_items.i: Move mark func for ControlWithItems into shared file so changes affect
...ject is still around first...
- static void mark_wxControlWithItems(void* ptr) {
-        VALUE rb_obj = SWIG_RubyInstanceFor(ptr);
-        if ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue )
-         return;
-
-        // On Windows, sometimes the wrong object is associated with the
-      &a...
2007 Jul 22
0
[1140] trunk/wxruby2/swig/mark_free_impl.i: Remove instance variable marking of deleted Wx Windows because it''s redundant
...UTC (rev 1140)
</span><span class="lines">@@ -8,8 +8,6 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> %{
</span><del>-static VALUE wx_destroyed_sym = rb_intern("@__wx_destroyed__");
-
</del><span class="cx"> // Code to be run when the ruby object is swept by GC - this only
</span><span class="cx"> // unlinks the C++ object from the ruby VALUE but doesn''t delete
</span><span class="cx"> // it bec...
2007 May 22
0
[1029] trunk/wxruby2/swig/classes/MenuBar.i: Add special GC protection for Wx::Menu to prevent premature destruction
...he mark
+// phase by Wx::App. However, the ruby object still must not be
+// destroyed while the Menu is still accessible on screen, because it
+// may be required to handle events.
+%{
+void mark_wxMenuBar(void *ptr)
+{
+ VALUE rb_win = SWIG_RubyInstanceFor(ptr);
+ if ( rb_iv_get(rb_win, "@__wx_destroyed__") == Qtrue )
+         return;
</ins><span class="cx">
</span><ins>+ wxMenuBar* menu_bar = (wxMenuBar*)ptr;
+ // Mark each menu in the menubar in turn
+ for ( int i = 0; i < menu_bar->G...
2007 May 22
0
[1028] trunk/wxruby2/swig/classes/App.i: Fix some GC-mark crashes when SWIG trackings return an unexpected object
...p    rb_obj_is_kind_of(rb_obj, cWxWindow.klass) &&
</ins><span class="cx">                  rb_iv_get(rb_obj, "@__wx_destroyed__") != Qtrue )
</span><span class="cx">          {
</span><span class="cx">             &am...
2007 May 22
0
[1032] trunk/wxruby2/swig: Preserve Sizers associated with Windows from GC; fix several sample
...class="lines">@@ -22,6 +22,37 @@
</span><span class="cx"> {
</span><span class="cx"> SWIG_RubyRemoveTracking(ptr);
</span><span class="cx"> }
</span><ins>+
+static VALUE wx_destroyed_sym = rb_intern("@__wx_destroyed__");
+bool GC_IsWindowDeleted(void *ptr)
+{
+ VALUE rb_win = SWIG_RubyInstanceFor(ptr);
+ return ( rb_ivar_defined(rb_win, wx_destroyed_sym ) == Qtrue );
+}
+
+// Default mark routine for Windows - preserve sizers
+void GC_mark_wxWindow(void *ptr)
+{
+
+ if ( GC_IsWindowDeleted(ptr) ) return;...