Fixed HWNDComponentPeer crash

Hi !

 

I found a fix for a little HWNDComponentPeer issue.

This fix resolve a very rare bug when application made a massive usage of TooltipWindow.

 

The application crashes in handleMovedOrResized() at line 318.

The caller is HWNDComponentPeer::peerWindowProc() line 2441

 

case WM_WINDOWPOSCHANGED:


{
  const Point<float> pos (getCurrentMousePos());
  if (contains (pos.roundToInt(), false))
      doMouseEvent (pos);
}

// I add this check because the previous call to doMouseEvent
if (isValidPeer (this))          // may invalidate this peer 
    handleMovedOrResized();      // on tooltips autoclosing for instance
else                             // instead
    {jassertfalse;}              // this assert confirms that I need to report the bug.

if (dontRepaint)
  break; // needed for non-accelerated openGL windows to draw themselves correctly..

return 0;

Tested on Window 7 64 Pro SP1

With last Juce version build in x64 with Visual Studio 2010 SP1.

 

Enjoy !

 

Ok, thanks, I'll add a check for that!

I just merge your version of this fix, thanks for your reactivity.