swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for Re: Heatbug Error


From: Nelson Minar
Subject: Patch for Re: Heatbug Error
Date: Thu, 22 Feb 1996 00:31:17 -0700

Thanks to help from Doug Donalson, Manor and I were able to track down
the bug he was seeing and (we think) squash it. A patch to the file
swarmlibs/simtools/ClassDisplayWidget.m is appended. Save the patch to
a file, cd to swarmlibs/simtools and type "patch < patchfile". If you
don't have the patch program installed on your system, you can do the
patch by hand (it's pretty simple).

The cause of the bug is instructive: a call to [mySuperClass getWidgetName]
was occasionally being sent when mySuperClass was nil. Because GNU objc
doesn't complain about messages to nil, the call silently evaluated to
0, and a null character pointer was passed off into the bowels of the
Tcl interpreter. There it happened not to crash under SunOS or Linux,
but did on Solaris.

The easiest way to find something like this is to run the program
under gdb and set a breakpoint on nil_method, the function that's
invoked when a message is sent to nil.

Here's the patch (patches are output from "diff -C 2". The !s mean
"replace this code with this code")

*** ClassDisplayWidget.m        Sun Feb 18 20:40:08 1996
--- /home/nelson/src/swarm/swarm/swarmlibs/simtools/ClassDisplayWidget.m        
Wed Feb 21 23:51:17 1996
***************
*** 119,131 ****
      [superB getWidgetName]] ;
  
!   [globalTkInterp eval: "%s configure -command {
!      pack %s -before %s -fill both -expand 1 ; %s configure -state disabled}",
!      [superB getWidgetName],[mySuperClass getWidgetName],
!      [self getWidgetName],[superB getWidgetName]] ;
! 
!   if(!mySuperClass)
!     [globalTkInterp
!      eval: "%s configure -state disabled", 
!     [superB getWidgetName]] ;
     
    leftFrame =  [Frame  createParent: self] ;  
--- 119,130 ----
      [superB getWidgetName]] ;
  
!   if (mySuperClass != nil) {
!     [globalTkInterp eval: "%s configure -command { pack %s -before %s -fill 
both -expand 1 ; %s configure -state disabled}",
!                   [superB getWidgetName],[mySuperClass getWidgetName],
!                   [self getWidgetName],[superB getWidgetName]];
!   } else {
!     [globalTkInterp eval: "%s configure -command { bell }; %s configure 
-state disabled",
!                   [superB getWidgetName], [superB getWidgetName]];
!   }
     
    leftFrame =  [Frame  createParent: self] ;  


reply via email to

[Prev in Thread] Current Thread [Next in Thread]