« Return to Thread: Crash reduced to 13 lines of code
I posted the patch to rubyforge here: http://rubyforge.org/tracker/index.php?func=detail&aid=24898&group_id=300&atid=1223
Lyle if you could release a new version of
FXRuby with this fix, I would really appreciate it.
Here is the summary so people don’t
have to follow the link:
Here the fix, the issue turned out to be very complicated relatedto how ruby handles the stack frames of its threads. In summary,you can't access stack variables between threads.FXMessageBox::warning creates the FXMessageBox on the stack.If the Garbage Collector running in another threads context trysto access the FXMessageBox, it blows up because the stack valuesare no longer in context. Below is the fix. Add this method to FXRbApp.cpp: FXWindow *FXApp::getFocusWindow() const { FXWindow *result=getActiveWindow(); VALUE value=FXRbGetRubyObj(result,true); if(!NIL_P(value)){ if(result){ while(result->getFocus()){ result=result->getFocus(); } } return result; } return NULL; } Update markfuncs.cpp FXRbWindow::markfunc with this change: Was:while(child!=NULL){ Is:while((child!=NULL) && (!(NIL_P(FXRbGetRubyObj(child,true))))){
Thanks,
Ryan
From:
fxruby-users-bounces@... [mailto:fxruby-users-bounces@...] On Behalf Of Melton, Ryan
Sent: Tuesday, May 12, 2009 1:26
PM
To: fxruby-users@...
Subject: [fxruby-users] Crash
reduced to 13 lines of code
Somebody who knows how to debug FXRuby please
help… The following 13 lines of code will cause a seg fault
immediately on Solaris/Ubuntu. I can’t make it any simpler than
this. The code dies in the garbage collect mark code trying to get
the focus window from FXApp (apparently because memory has become corrupted).
Thanks,
Ryan
require 'rubygems'
require 'thread'
require 'fox16'
include Fox
Thread.new do
loop do
GC.start
end
end
application = FXApp.new("NA", "NA")
application.create
FXMessageBox.warning(FXApp.instance, MBOX_OK, 'Warning!',
'Are you sure?')
This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address.
This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address.
« Return to Thread: Crash reduced to 13 lines of code
| Free embeddable forum powered by Nabble | Forum Help |