Bug 237948 - [GTK][WPE] Debug build assertion, TextureMapperPlatformLayerProxyGL asserts when going back in the minibrowser
Summary: [GTK][WPE] Debug build assertion, TextureMapperPlatformLayerProxyGL asserts w...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alejandro G. Castro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-16 01:38 PDT by Alejandro G. Castro
Modified: 2022-03-19 14:51 PDT (History)
13 users (show)

See Also:


Attachments
Patch (1.96 KB, patch)
2022-03-16 01:47 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alejandro G. Castro 2022-03-16 01:38:34 PDT
We are not initializing m_compositorThread properly with the invalidation and the ThreadedCompositor is destroyed after a navigation, and when going back the browser asserts.
Comment 1 Alejandro G. Castro 2022-03-16 01:45:23 PDT
Added a new bug for a follow up patch to create a test for the ThreadedCompositor destroyed situation.
Comment 2 Alejandro G. Castro 2022-03-16 01:46:37 PDT
I forgot to say it is bug 237949.
Comment 3 Alejandro G. Castro 2022-03-16 01:47:27 PDT
Created attachment 454811 [details]
Patch
Comment 4 EWS 2022-03-16 06:04:55 PDT
Committed r291342 (248481@main): <https://commits.webkit.org/248481@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454811 [details].
Comment 5 Radar WebKit Bug Importer 2022-03-16 06:05:18 PDT
<rdar://problem/90365573>
Comment 6 Michael Catanzaro 2022-03-16 08:06:05 PDT
Comment on attachment 454811 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454811&action=review

> Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxyGL.cpp:96
> +#ifndef NDEBUG
> +        m_compositorThread = nullptr;
> +#endif

I'm not sure if the #ifndef NDEBUG was a great idea... when I see this, I think "why is this only needed with asserts enabled?" Probably better to keep the debug/release codepaths similar rather than different.

Also: WebKit asserts can be enabled (ASSERT_ENABLED) even if libc asserts are not (NDEBUG).
Comment 7 Carlos Garcia Campos 2022-03-16 08:12:52 PDT
(In reply to Michael Catanzaro from comment #6)
> Comment on attachment 454811 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454811&action=review
> 
> > Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxyGL.cpp:96
> > +#ifndef NDEBUG
> > +        m_compositorThread = nullptr;
> > +#endif
> 
> I'm not sure if the #ifndef NDEBUG was a great idea... when I see this, I
> think "why is this only needed with asserts enabled?" Probably better to
> keep the debug/release codepaths similar rather than different.
> 
> Also: WebKit asserts can be enabled (ASSERT_ENABLED) even if libc asserts
> are not (NDEBUG).

That's right, ASSERT_ENABLED should be used here and in other places where NDEBUG is used for m_compositorThread
Comment 8 Alejandro G. Castro 2022-03-16 08:59:25 PDT
(In reply to Michael Catanzaro from comment #6)
> Comment on attachment 454811 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454811&action=review
> 
> > Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxyGL.cpp:96
> > +#ifndef NDEBUG
> > +        m_compositorThread = nullptr;
> > +#endif
> 
> I'm not sure if the #ifndef NDEBUG was a great idea... when I see this, I
> think "why is this only needed with asserts enabled?" Probably better to
> keep the debug/release codepaths similar rather than different.
> 

Basically all the file is using the variable with NDEBUG, if we don't use it the variable is not even defined, there is no change in the behaviour. It would be great if you can review this and the other proxies and propose a patch, I think the dmabuf is using a similar setup.

> Also: WebKit asserts can be enabled (ASSERT_ENABLED) even if libc asserts
> are not (NDEBUG).

Urg, in that case even the compilation is broken because the variable is defined in the headers inside NDEBUG guards. A patch for that kind of code is really welcome.
Comment 9 Michael Catanzaro 2022-03-16 09:09:04 PDT
(In reply to Alejandro G. Castro from comment #8)
> Basically all the file is using the variable with NDEBUG, if we don't use it
> the variable is not even defined, there is no change in the behaviour.

Oh OK, of course that's fine then.

Should probably still use ASSERT_ENABLED rather than NDEBUG, but I see we have many other places in WebKit using NDEBUG. I suppose whoever next tries to enable assertions in release builds will wind up figuring this out....