Re: W98 crash running Calculat.exw from Judith's IDE

new topic     » goto parent     » topic index » view thread      » older message » newer message

Pete writes:
> OK, I have hacked it down to the following:-
> 
> include Win32lib.ew
> without warning
> constant Calcw = create( Window, "Calc", 0, 78, 40, 246, 282, 0)
> constant Table2 = create( PushButton, "9", Calcw, 74, 4, 30, 30, 0)
> setHint( Table2,"9")
>     
> procedure screen_event( integer iMsg, atom lParam, atom wParam )    
>   seq loc                  
>   loc=getRect(Calcw)  
> end procedure    
> onEvent[Screen] = routine_id("screen_event")   
> 
> WinMain( Calcw, Normal )
> 
> -- If I comment out EITHER the setHint or the getRect It no longer
> crashes when I close the window. I don't know enuf about win32lib yet
> to trace it any further.
> 
> -- Does this close ok on your machine, Irv?

It crashes because the scree_event() tries to call
getRect() after Calcw is closed, which causes the crash.
Workaround is:

<CODE>

include Win32lib.ew
without warning
constant Calcw = create( Window, "Calc", 0, 78, 40, 246, 282, 0)
constant Table2 = create( PushButton, "9", Calcw, 74, 4, 30, 30, 0)
setHint( Table2,"9")
    
procedure screen_event( integer iMsg, atom lParam, atom wParam )    
  seq loc
  seq info
  info = getControlInfo( Calcw, {CONTROLINFO_closed})
  if info[1] then
   -- Calcw is closed, don't measure
   return 
  end if
  loc = getRect(Calcw)
end procedure    
onEvent[Screen] = routine_id("screen_event")

WinMain( Calcw, Normal)

</CODE>

And it should be ok. However, this points to
internal bug in win32lib. (Assuming Bimtap just
by not validId(), which is wrong) 
To fix it, change win32lib.ew to:

<PATCH>
    in function getRect() around line 12130:
    add at the top of the function (after var declarations) this :
        if not validId(id) then
            -- bad id (maybe say something?)
            return {0,0,0,0}
        end if
    and replace
        elsif not validId (id) then
    by
        elsif window_type[id] = Bitmap then
</PATCH>

Thanks for the report. I'll pass it to Derek.

N.B: Anyone know when will Derek come back from vacations ?

    Martin

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu