assertions firing in Component::paintEntireComponent()

Gee, I’m busy on this forum in the last few days! Hope it isn’t too dull - I do do my homework before I post.

There’s an assertion, jassert (! g.isClipEmpty()); in Component::paintEntireComponent() that used to fire occasionally for me.

Now it fires all the time, making debugging impossible - I had to disable it.

I thought it was something to do with my playing with the clip rectangle so I disabled all that - but it still fires. I even intercept internalRepaint and filter all requests where width * height is zero…

  1. How could I be causing it?
  2. What am I risking by disabling that assertion? Everything works fine if I disable it…

If the assert is firing it means that no part of the Component intersects the visible area of the clip region. Therefore, one of your assumptions is wrong. But which one? That is the question.

Sounds like it’s related to your CoreGraphics clipping problem… I reckon that what’s happening is:

  • You’ve got a complex clipping region which doesn’t intersect this component, but whose bounding-box does overlap it
  • Because there’s no way to ask CoreGraphics whether the component’s rectangle intersects the clip region, my code can only check whether the bounding box intersects, which is does, so it attempts to paint it.
  • When it tries to paint it, it asks CoreGraphics to clip to the component’s rectangle, and that results in an empty clip region…

But… I just looked at my latest code and the assertion’s not there, so maybe I already spotted this and removed it!