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 misplaced #2

Open
huxingyi opened this issue Nov 4, 2020 · 1 comment
Open

Cleanup misplaced #2

huxingyi opened this issue Nov 4, 2020 · 1 comment

Comments

@huxingyi
Copy link

huxingyi commented Nov 4, 2020

Hi, I found a small issue in the code, when you have multiple windows, close one of them will delete other window's shadow map:

glDeleteTextures(1, &m_shadowMapTex);

The cleanup operation should be put into a slot for aboutToBeDestroyed

void ShadowRenderWindow::cleanup()
{
    makeCurrent();
    if(m_shadowMapTex > 0)
        glDeleteTextures(1, &m_shadowMapTex);
    if(m_shadowMapFBO > 0)
        glDeleteFramebuffers(1, &m_shadowMapFBO);
    doneCurrent();
}

void ShadowRenderWindow::initializeGL()
{
    connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &ShadowRenderWindow::cleanup);
    .... ....
}
@pnudupa
Copy link
Owner

pnudupa commented Nov 21, 2020

Hi @huxingyi - My genuine apologies for the super late reply. I will check this out and update the code. Thank you so much for your contribution.

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

2 participants