search for: swig_rubyinstancefor

Displaying 20 results from an estimated 27 matches for "swig_rubyinstancefor".

2007 Jul 21
0
[1135] trunk/wxruby2/swig/mark_free_impl.i: Convert from DOS to Unix newlines
...SWIG_RubyRemoveTracking(ptr); -} - -// Tests if the window has been signalled as destroyed by a -// WindowDestroyEvent handled by wxRubyApp -bool GC_IsWindowDeleted(void *ptr) -{ - // If objects have been ''unlinked'' then DATA_PTR = 0 - if ( ! ptr ) return true; - VALUE rb_win = SWIG_RubyInstanceFor(ptr); - if ( rb_ivar_defined(rb_win, wx_destroyed_sym ) ) -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn true; - else -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn false; -} - -// Notes that the window has been signalled as destro...
2007 Jul 21
0
[1127] trunk/wxruby2: Move shared C++ GC functions into separate file included into wx.i
...it because it is still needed and will be managed by WxWidgets. +void GcNullFreeFunc(void *ptr) +{ + SWIG_RubyRemoveTracking(ptr); +} + +// Tests if the window has been signalled as destroyed by a +// WindowDestroyEvent handled by wxRubyApp +bool GC_IsWindowDeleted(void *ptr) +{ + VALUE rb_win = SWIG_RubyInstanceFor(ptr); + if ( rb_ivar_defined(rb_win, wx_destroyed_sym ) ) +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn true; + else +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn false; +} + +// Notes that the window has been signalled as destro...
2007 Jul 05
0
[1109] trunk/wxruby2/swig: Move marking of MenuBar from direct %markfunc to via mark_wxFrame, so
...sp&nbsp// Would be neater - but can''t do it this way b/c of destruction sequence -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// SWIG_RubyUnlinkObjects((void *)wx_obj); - -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor((void *)wx_obj); -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_iv_set(rb_obj, "@__wx_destroyed__", Qtrue); </del><ins>+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspGC_SetWindowDeleted(wx_obj); </ins><span class=...
2007 Jul 20
0
[1123] trunk/wxruby2/swig/wx.i: Check sizers being marked have a ruby rep and are not internal Wx-only,
...sp2007-07-20 08:58:51 UTC (rev 1123) </span><span class="lines">@@ -36,7 +36,8 @@ </span><span class="cx"> void GC_SetWindowDeleted(void *ptr) </span><span class="cx"> { </span><span class="cx"> VALUE rb_win = SWIG_RubyInstanceFor(ptr); </span><del>- rb_ivar_set(rb_win, wx_destroyed_sym, Qtrue); </del><ins>+ if ( rb_win != Qnil ) +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_ivar_set(rb_win, wx_destroyed_sym, Qtrue); </ins><span class="cx"> } </...
2007 Jun 27
0
[1089] trunk/wxruby2/swig/classes/TreeCtrl.i: Hide missing method call in TreeCtrl on Win32
...pan><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspimg_list = tree_ctrl->GetImageList(); </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( img_list ) rb_gc_mark(SWIG_RubyInstanceFor(img_list)); </span><ins>+#if !defined(__WXMSW__) </ins><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspimg_list = tree_ctrl->GetButtonsImageList(); </span><span class="cx"> &nbsp&nbsp&nb...
2007 Jun 05
0
[1046] trunk/wxruby2/swig/classes/TreeCtrl.i: Prevent crashes in TreeCtrl from premature deletion of associated ImageList
...nbsp&nbsp&nbsp// First check if there''s ImageLists and mark if found +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspimg_list = tree_ctrl->GetImageList(); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( img_list ) rb_gc_mark(SWIG_RubyInstanceFor(img_list)); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspimg_list = tree_ctrl->GetButtonsImageList(); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( img_list ) rb_gc_mark(SWIG_RubyInstanceFor(img_list)); +&nbsp&nbsp&nbsp&...
2007 May 22
0
[1032] trunk/wxruby2/swig: Preserve Sizers associated with Windows from GC; fix several sample
...x"> { </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; + + wxWindow* wx_win = (wxWindow*)ptr; + wxSizer* wx_sizer = wx_win->GetSizer();...
2007 Jul 19
0
[1122] trunk/wxruby2/swig/classes/PrintPreview.i: Mark the PrintOuts associated with a Preview to prevent premature
...;nbsp&nbsp&nbsp&nbspwxPrintPreview* print_preview = (wxPrintPreview*)ptr; +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspwxPrintout* printout = print_preview->GetPrintout(); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_gc_mark( SWIG_RubyInstanceFor(printout) ); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspwxPrintout* printout_for_printing = print_preview->GetPrintoutForPrinting(); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_gc_mark( SWIG_RubyInstanceFor(printout_for_printing) ); +...
2007 Jul 22
0
[1140] trunk/wxruby2/swig/mark_free_impl.i: Remove instance variable marking of deleted Wx Windows because it''s redundant
...class="cx"> bool GC_IsWindowDeleted(void *ptr) </span><span class="cx"> { </span><span class="cx"> // If objects have been ''unlinked'' then DATA_PTR = 0 </span><del>- if ( ! ptr ) return true; - VALUE rb_win = SWIG_RubyInstanceFor(ptr); - if ( rb_ivar_defined(rb_win, wx_destroyed_sym ) ) </del><ins>+ if ( ! ptr ) </ins><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn true; </span><span class="cx"> else </span>&l...
2007 May 22
0
[1029] trunk/wxruby2/swig/classes/MenuBar.i: Add special GC protection for Wx::Menu to prevent premature destruction
...ass of Window so isn''t automatically protected in the 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 ) +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp return; </ins><span class="cx"> </span><ins>+ wxMenuBar* menu_bar = (wxMenuBar*)ptr; + // Mark each menu in the m...
2007 Jul 04
0
[1108] trunk/wxruby2/swig: Revised mem mgmt for Sizers to address more GC crashes in Sizers demo
...sp&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 VALUE rb_child_sizer = SWIG_RubyInstanceFor(child_sizer); -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp rb_gc_mark(rb_child_sizer); -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&...
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
...sp&nbsp// Would be neater - but can''t do it this way b/c of destruction sequence +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// SWIG_RubyUnlinkObjects((void *)wx_obj); + +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor((void *)wx_obj); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsprb_iv_set(rb_obj, "@__wx_destroyed__", Qtrue); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspevent.Skip(); + } + + + static VALUE mark_iterate(VALUE pair, VALUE arg, VALU...
2007 Jul 21
0
[1137] trunk/wxruby2/swig/classes/TreeCtrl.i: Call correct shared function to check whether TreeCtrl is deleted in markfunc
...SWIG''s entry point function for GC mark </span><span class="cx"> static void mark_wxTreeCtrl(void *ptr) </span><span class="cx"> { </span><del>-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue ) </del><ins>+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( GC_IsWindowDeleted(ptr) ) </ins><span class=...
2007 Jul 20
0
[1125] trunk/wxruby2/swig/shared/control_with_items.i: Avoid MSW crashes when unexpected object is returned by SWIG tracking
...p&nbsp&nbsp&nbsp&nbsp&nbspVALUE returnVal = (VALUE) ptr->GetClientData(n); </span><span class="lines">@@ -24,8 +26,12 @@ </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue ) </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nb...
2007 May 21
0
[1026] trunk/wxruby2/swig/shared/control_with_items.i: Memory mgmt: USe __wx_destroyed__ instead of __swig_dead__; fix some
...ot;> // Checks whether the C++ object is still around first... </span><span class="cx"> static void mark_wxControlWithItems(void* ptr) { </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); </span><del>-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_ivar_get(rb_obj, rb_intern("@__swig_dead__") ) == Qtrue ) </del><ins>+&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_iv_get(rb_obj, &...
2007 Jul 21
0
[1133] trunk/wxruby2/swig/shared/control_with_items.i: Move mark func for ControlWithItems into shared file so changes affect
...gt;<del>- - // Prevents Ruby''s GC sweeping up items that are stored as client data - // Checks whether the C++ object is still around first... - static void mark_wxControlWithItems(void* ptr) { -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_iv_get(rb_obj, "@__wx_destroyed__" ) == Qtrue ) -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp return; - -&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&...
2007 Mar 17
0
[889] branches/wxruby2/wxwidgets_282/swig/shared/control_with_items.i: Ensure SWIG doesn''t generate wrappers for client data methods (Artur Kuptel)
...</span><span class="cx"> // Returns a ruby object stored as client data </span><span class="lines">@@ -26,11 +24,15 @@ </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_ivar_get(rb_obj, rb_intern("@__swig_dead__") ) == Qtrue ) </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&n...
2007 Jul 21
0
[1134] trunk/wxruby2/swig/mark_free_impl.i: When window is deleted, unhook ruby obj from DATA_PTR to avoid MSW crashes
...class="cx"> bool GC_IsWindowDeleted(void *ptr) </span><span class="cx"> { </span><ins>+ // If objects have been ''unlinked'' then DATA_PTR = 0 + if ( ! ptr ) return true; </ins><span class="cx"> VALUE rb_win = SWIG_RubyInstanceFor(ptr); </span><span class="cx"> if ( rb_ivar_defined(rb_win, wx_destroyed_sym ) ) </span><span class="cx"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspreturn true; </span><span class="lines">@@ -37,6 +39,...
2007 Jun 28
0
[1092] trunk/wxruby2/swig/classes/App.i: Pass correctly typed Events into filter_event, if defined (bug 10797);
...n><span class="cx"> } </span><del>-&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp </del><ins>+ + + int FilterEvent(wxEvent& event) { +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_self = SWIG_RubyInstanceFor(this); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// Just proceed if no ruby filter_event method is defined in App class +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp// filter_event_sym defined above +&nbsp&nbsp&nbsp&nbsp&amp...
2006 Nov 07
0
[722] trunk/wxruby2/swig: Wx::Choice fixes for get_client_data (AF)
...by2 license + +// Prevents Ruby''s GC sweeping up items that are stored as client data +// Checks whether the C++ object is still around first... + +%{ + static void mark_wxControlWithItems(void* ptr) { +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspVALUE rb_obj = SWIG_RubyInstanceFor(ptr); +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspif ( rb_ivar_get(rb_obj, rb_intern("@__swig_dead__") ) == Qtrue ) +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp return; + +&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&amp...