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

cleanup context variables on object/context destruction #71

Closed
umlaeute opened this issue Sep 18, 2014 · 1 comment
Closed

cleanup context variables on object/context destruction #71

umlaeute opened this issue Sep 18, 2014 · 1 comment

Comments

@umlaeute
Copy link
Owner

When an object that holds context-specific data (using gem::ContextData<>) is destroyed, all context-data should be destroyed in the correct context.
This involves switching to each context and freeing any resources.
e.g.

     static void GemContext::forEachContext(GemBase&obj) {
        oldctx=getCurrentContext();
        for ctx in contexts
        do
            ctx.makeCurrent();
            obj.removedContext();
        done
        oldctx.makeCurrent();
    }

Similiary, when an openGL-context is destroyed (e.g. by closing a window), each object holding context-specific data should be called to free the resources of this context:

    myContext::destroy() {
          makeCurrent();
          for obj in GemBase::objects
          do
                obj.removedContext();
          done
    }
@umlaeute
Copy link
Owner Author

afaict, this has been implemented with d7f5cfc..953c70f

(note that the above-mentioned GemContext::forEachContext is slightly different, as it does not restore the originally active context!)

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

No branches or pull requests

1 participant