Review Request 126131: Don't delete gl texture twice in thumbnail

David Edmundson david at davidedmundson.co.uk
Mon Nov 23 13:14:51 UTC 2015



> On Nov. 23, 2015, 7:13 a.m., Martin Gräßlin wrote:
> > are you sure it means that? I mean I did read the documentation when writing that code and did deliberately wrote the code like that. So I'm a little bit surprised that I got it exactly the other way around.

How do you interpret:
"The texture object owns the texture id and will delete the GL texture when the texture object is deleted." ?


Docs aside, relevant Qt code is:

QSGTexture *QSGEngine::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
{
    Q_D(const QSGEngine);
    if (d->sgRenderContext->isValid()) {
        QSGPlainTexture *texture = new QSGPlainTexture();
        texture->setTextureId(id);
        texture->setHasAlphaChannel(options & TextureHasAlphaChannel);
        texture->setOwnsTexture(options & TextureOwnsGLTexture);
        texture->setTextureSize(size);
        return texture;
    }
    return 0;
}


QSGPlainTexture::~QSGPlainTexture()
    if (m_texture_id && m_owns_texture && QOpenGLContext::currentContext())
        QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_texture_id);


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126131/#review88703
-----------------------------------------------------------


On Nov. 22, 2015, 1:57 a.m., David Edmundson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126131/
> -----------------------------------------------------------
> 
> (Updated Nov. 22, 2015, 1:57 a.m.)
> 
> 
> Review request for KDE Frameworks and Plasma.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> The QSGTextures are created with
> 
> window()->createTextureFromId(m_texture, QSize(w,h),
> QuickWindow::TextureOwnsGLTexture));
> 
> this means we don't want to be deleting textures ourselves too, it will
> be deleted when we delete the QSGTexture, which is a scoped pointer
> inside our QSGNode.
> 
> BUG: 355644
> REVIEW:
> 
> 
> Diffs
> -----
> 
>   src/declarativeimports/core/windowthumbnail.cpp 2b09657e8ce6bd1cca1acc323d5955b2f1a1efb2 
> 
> Diff: https://git.reviewboard.kde.org/r/126131/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David Edmundson
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20151123/cc043d25/attachment.html>


More information about the Plasma-devel mailing list