Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure false-positives when using OpenGL in audio plugins in OS X #88

Closed
yairchu opened this issue Aug 7, 2016 · 9 comments

Comments

@yairchu
Copy link

yairchu commented Aug 7, 2016

To trigger this bug we need to modify the JUCE demo plugin to use OpenGL with continuous rendering enabled.

Demo plugin modifications:

  • Add the juce_opengl module via the projucer
  • Add an OpenGLContext context; member in JuceDemoPluginAudioProcessorEditor.
  • Add context.attachTo (*this); context.setContinuousRepainting (true); in JuceDemoPluginAudioProcessorEditor's constructor and context.detach(); in its destructor.

Then debug the plugin in Xcode when running via Traction 7.1.1 (though I believe the behavior is similar across all hosts), and use the plugin as either AU, VST, or VST3. Just open a plugin window and then either close it or switch to a different application. This triggers the assertion error in checkGLError about 90% of the time.

Tested on OS X 10.11.6 using Xcode 7.3.1, in 64-bit mode, with either the JUCE master branch or the develop branch.

The following patch which adds some additional checks in checkGLError for these cases seems to almost solve the problem but it still occasionally triggers: soundradix@7d371d7
When combined with changes making the OpenGL rendering on OS X use CVDisplayLink (these new changes are available in soundradix's branch but are not yet thoroughly tested), the above patch appears to solve the issue completely.

@hogliux hogliux self-assigned this Aug 8, 2016
@hogliux
Copy link
Contributor

hogliux commented Aug 8, 2016

I think the suggested checks in checkGLError are really just a workaround for the underlying problem that the openGLContext needs to know when the component is removed from a peer before it happens. I'll try to add a workaround....

juce-push-bot pushed a commit that referenced this issue Aug 8, 2016
@hogliux
Copy link
Contributor

hogliux commented Aug 8, 2016

Can you confirm that this is now fixed on develop?

@yairchu
Copy link
Author

yairchu commented Aug 8, 2016

With the latest develop adding the JUCE demo plugin (unmodified/without OpenGL) in Tracktion as VST or VST3 crashes. (and before the last commit 99186e5 it doesn't crash)

@hogliux
Copy link
Contributor

hogliux commented Aug 8, 2016

OK Let me know if it works now.

@yairchu
Copy link
Author

yairchu commented Aug 9, 2016

It still crashes as VST and VST3..

Tried to enable address sanitizer and thread sanitizer to see if I get any clues to the cause of the crash.. tsan writes some stuff that seems irrelevant but maybe this line is relevant:

2016-08-09 12:57:24.735 Tracktion64[14907:5355622] 
JUCEView_1bdc6b5442e1b823(0x7d2800032820) - NSView not correctly initialized. Did you forget to call super?

?

juce-push-bot pushed a commit that referenced this issue Aug 11, 2016
…JUCE-internal fix for OpenGLContext detach crash

Fixes #88
@hogliux
Copy link
Contributor

hogliux commented Aug 11, 2016

Can you check if the latest commit on develop fixes the issue?

@yairchu
Copy link
Author

yairchu commented Aug 11, 2016

Yes! Looks like it works now!

@hogliux
Copy link
Contributor

hogliux commented Aug 11, 2016

Thank you for reporting!

@hogliux hogliux closed this as completed Aug 11, 2016
yairchu added a commit to soundradix/JUCE that referenced this issue Aug 11, 2016
…ug-in windows"

This reverts commit 7d371d7.

The bug was eventually solved differently in the official juce branch and this is no longer needed.
See juce-framework#88
yairchu added a commit to soundradix/JUCE that referenced this issue Nov 7, 2016
This means that debug assertion trigger when closing plugin window occasionally, or near-always if also using plain JUCE opengl support without using CVDisplayLink as in SR's branch.

Revert "Partially undo commits #99186e5 and #89d938d and use less-intrusive, JUCE-internal fix for OpenGLContext detach crash"

This reverts commit c7b3472.

Revert "Call removeFromDesktop when an external host tries to remove a juce component from a window (Fixes juce-framework#88)"

This reverts commit 99186e5.
yairchu added a commit to soundradix/JUCE that referenced this issue Nov 7, 2016
@yairchu
Copy link
Author

yairchu commented Nov 7, 2016

I verified that reverting the fixes for this issue (soundradix@1935232) resolves #120 which was introduced by them.

Applying instead the fix that I previously suggested (soundradix@589d7cc), on SR's branch which uses CVDisplayLink on macOS, seems to resolve this issue without introducing any other problems afaik so far..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants