Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e537b18e authored by Tomislav Novak's avatar Tomislav Novak
Browse files

hwui: Fix multiple definitions of NativeFamilyBuilder



There are two _different_ definitions of the NativeFamilyBuilder class,
one in jni/FontFamily.cpp and the other in jni/fonts/FontFamily.cpp,
violating the one-definition rule. Make them local by moving to an
anonymous namespace.

This is an issue in non-optimized builds where ~NativeFamilyBuilder
isn't inlined, so the wrong destructor ends up being called:
```
(gdb) bt
[...]
 #3  0x0000007292c44a8c in std::__1::vector<minikin::FontVariation,
         std::__1::allocator<minikin::FontVariation> >::~vector ()
 #4  0x0000007292c44a54 in android::NativeFamilyBuilder::~NativeFamilyBuilder ()
 #8  0x0000007292c64cec in android::FontFamily_Builder_build ()
```
(note that the struct used by FontFamily_Builder_build() doesn't have
the vector<minikin::FontVariation> field)

Test: add "-O0" to hwui cflags and verify that system_server no longer
      hangs on startup
Signed-off-by: default avatarTomislav Novak <tnovak@meta.com>
Change-Id: Ic071a7c00a9b2f632b6f56877f54c6a58eb38965
parent c2fa03fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment