From 13dbbd0fab636b22cb0ba8396dd0861f7e08ee26 Mon Sep 17 00:00:00 2001 From: Lyle Johnson <lyle@lylejohnson.name> Date: Tue, 26 May 2009 15:27:41 -0500 Subject: [PATCH] implemented Ryan Melton's patch for RubyForge Bug #24898 --- ext/fox16/markfuncs.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ext/fox16/markfuncs.cpp b/ext/fox16/markfuncs.cpp index bea3a48..182e3ed 100755 --- a/ext/fox16/markfuncs.cpp +++ b/ext/fox16/markfuncs.cpp @@ -198,7 +198,7 @@ void FXRbWindow::markfunc(FXWindow* self){ // Mark child windows register FXWindow* child=self->getFirst(); - while(child!=NULL){ + while((child!=NULL) && (!(NIL_P(FXRbGetRubyObj(child,true))))){ FXRbGcMark(child); child=child->getNext(); } @@ -296,6 +296,25 @@ void FXRbCursor::freefunc(FXCursor* self){ delete_if_not_owned_by_app(self,reinterpret_cast<FXRbCursor*>(0)); } +/** + * Overrides base class version of getFocusWindow() to address + * RubyForge Bug #24898. + */ +static FXWindow* +getFocusWindow(FXApp *self) +{ + FXWindow *result=self->getActiveWindow(); + VALUE value=FXRbGetRubyObj(result,true); + if(!NIL_P(value)){ + if(result){ + while(result->getFocus()){ + result=result->getFocus(); + } + } + return result; + } + return NULL; + } void FXRbApp::markfunc(FXApp *self){ FXRbObject::markfunc(self); @@ -335,7 +354,7 @@ void FXRbApp::markfunc(FXApp *self){ FXRbGcMark(self->getDefaultCursor(DEF_ROTATE_CURSOR)); // Other windows - FXRbGcMark(self->getFocusWindow()); + FXRbGcMark(::getFocusWindow(self)); FXRbGcMark(self->getCursorWindow()); /** -- GitLab