« Return to Thread: Crash reduced to 13 lines of code

Re: Patch for crashes

by Melton, Ryan :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.

Surprisingly, it compiled and worked for me.  I’m thinking the compiler just used this version of getFocusWindow for calls within fox16.so.

 

The problem with only fixing it in markfuncs.cpp is that users could still crash cause a seg fault by doing:

 

app = FXApp.new

 

Thread.new do

  app.focusWindow

end

 

The intent was to override the getFocusWindow function call so as to make sure that the value returned by getActiveWindow internally was valid.

 

I’m not sure why it links without errors… maybe ruby just ignores dynamic linking errors of that kind.

Ryan

 


From: fxruby-users-bounces@... [mailto:fxruby-users-bounces@...] On Behalf Of Lyle Johnson
Sent: Tuesday, May 26, 2009 2:14 PM
To: fxruby-users@...
Subject: Re: [fxruby-users] Patch for crashes

 

 

On May 14, 2009, at 11:04 AM, Melton, Ryan wrote:



 

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:

 

<snip>



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;
  }

 

Was your intent here to replace the version of FXApp::getFocusWindow() that is compiled into the FOX library? Because as it's written you're just going to get duplicate symbols error at link time.

 

The getFocusWindow() isn't declared as a virtual function in the FXApp class, so we can't override it in the FXRbApp subclass. If the only concern is that the call to FXApp::getFocusWindow() can crash during the GC phase, however, I can probably just apply this patch as a special case in the FXRbApp::markfunc (in markfuncs.cpp). I'll try that and see if it does the trick.


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.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

 « Return to Thread: Crash reduced to 13 lines of code