RE: Strange crash

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

Matthew Lewis wrote:
> 
> I've been having this really strange crash, which I can't explain.  It's 
> in
> a function that's used as a callback for an ActiveX control.  It crashes 
> on
> this line (machine exception):
> 
> rect[3..4] += rect[1..2]
> 
> but only in certain places:
> 
> function IOleInPlaceSite_GetWindowContext( atom this, atom ppFrame, 
>         atom ppDoc, atom lprcPosRect, atom lprcClipRect, atom lpFrameInfo )
> 
>     sequence rect
>     integer obj_ix
>     atom pframe
>     
>     obj_ix = get_obj_from_this( this )
> 
>     if not obj_ix then
>         poke4( ppFrame, 0 )
>         poke4( ppDoc, 0 )
>         poke4( lprcPosRect, repeat(0, 4 ) )
>         poke4( lprcClipRect, repeat( 0, 4 ) )
>         poke4( lpFrameInfo, repeat( 0, 5 ) )
>         -- E_UNEXPECTED
>         return #800FFFF
>     end if
>     
>     rect = obj_table[OBJ_POS][obj_ix]
> 
>     -- ************************************************
>     -- WORKS OK HERE
>     rect[3..4] += rect[1..2]
>     -- ************************************************
> 
>     -- supply the pointer to IOleInPlaceFrame
>     pframe = find( IOleInPlaceFrame_b, interface_table[I_BYTES] )
>     pframe = interface_table[I_THIS][pframe]
>     poke4( ppFrame, pframe )
> 
>     -- ************************************************
>     -- CRASHES HERE
>     --rect[3..4] += rect[1..2]
>     -- ************************************************
>     
>     poke4( lprcPosRect, rect )
>     poke4( lprcClipRect, rect )
>     
>     -- Fill OLEINPLACEFRAME
>     poke4( lpFrameInfo, { 20, 0, obj_table[OBJ_PARENT][obj_ix],
>                           0, 0 } )
>     return 0
> end function
> 
> I haven't been able to duplicate this elsewhere, but it reminds me of
> something where win32lib crashes if you call allocate before creating
> controls (at least it did at one point).  Has anyone else ever seen 
> this?
> Have any ideas about what's causing it?  Oh, I can also stop the crash 
> by
> changing the line to
> 
> rect[3] += rect[1]
> rect[4] += rect[2]
> 
> or printing or somehow referring to rect differently, or simply opening 
> up
> the trace window.  It's like it didn't properly allocate space correctly 
> or
> something.
> 
> Matt Lewis
> 
> 

Matt:

  Did you try NOT using slicing math to see if this has something
  to do with the prroblem.

  rect[3] += rect[1]
  rect[4] += rect[2]

  OR

  rect[3] = rect[3] + rect[1]    
  rect[4] = rect[4] + rect[2]    

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu