Review Request 126131: Don't delete gl texture twice in thumbnail
Martin Gräßlin
mgraesslin at kde.org
Mon Nov 23 13:50:07 UTC 2015
> On Nov. 23, 2015, 8: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.
>
> David Edmundson wrote:
> 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);
given the code in plasma-framework, I'm quite certain that I didn't want Qt to take over ownership of it. So I think we should turn it around and make our code do what was intended. I just checked and we do proper cleanup handling. discardPixmap is called from the dtor, so if we do cleanup, why should Qt?
- Martin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126131/#review88703
-----------------------------------------------------------
On Nov. 22, 2015, 2: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, 2: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/kde-frameworks-devel/attachments/20151123/b5f612d9/attachment.html>
More information about the Kde-frameworks-devel
mailing list