StretchableLayoutResizerBar triggers OpenGL warnings on macOS

Hi,
I’m kind of new around here so I’m not sure whether this is the best place to report potential bugs.

StretchableLayoutResizerBar::paint() directly calls isMouseOver(). When the component is attached to an OpenGL context, paint() is called outside the main thread, and since isMouseOver() maps to a macOS UI call this triggers a warning:

Main Thread Checker: UI API called on a background thread: -[NSView frame]

The fix is seemingly quite simple :
StretchableLayoutResizerBar-avoid-mouse-over-call.diff (2.5 KB)

JUCE Devs, is this worth a pull request? Or what’s the best way to report it?

Hi there,
Bumping this because I just found another component suffering from the same issue: ScrollBar::paint() calls isMouseOver() and isMouseButtonDown(). So it triggers the same UI API check warning when attached to a GL context.
Is that a second bug or am I missing something?

… and the patch fixing this second instance in ScrollBar:
ScrollBar-avoid-mouse-over-call.diff (2.4 KB)

Wouldn’t the issue persist, what with of isMouseButtonDown() still in use in StretchableLayoutResizerBar? In other words, the storing of a isMouseDown bool treatment seems to need to be applied there - based on what you’re saying that is.

@jrlanglois yes, that’s precisely what I’m doing in the patches attached.

And you’re missing a replacement of the call to isMouseButtonDown in your patches.

Oh, right, I see what you meant now. It turns out calling isMouseButtonDown doesn’t trigger the macOS warning, which is why I didn’t replace it in the first patch but you’re right, it would probably be a good idea.

I’ll complete the patch if there’s interest in merging it (still hoping to get feedback from official devs).

I’ve put together a solution for this issue. I think it probably makes more sense to address this directly in Component, rather than in each of the individual derived components. I’ll update this thread once the change is merged.

Great,thanks @reuk.

This should fix the issue:

That’s great removing some noise :slight_smile:

btw, also isMinimized can cause similar thing.

    bool isMinimised() const override
    {
        return [window isMiniaturized];
    }

Under what circumstances do you see this issue with isMinimised? I wouldn’t expect components to need to check isMinimised during painting, but maybe there’s a use-case I’ve overlooked.

Currently when a view is minimized (At least on macOS), the paint callback still triggers.

isMinimised can be used to reduce some painting.
Maybe it’s a corner case but I had this triggered once so thought it’s worth noting. :slight_smile: