File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 license: MIT
3434
3535 dependencies: harfbuzz sheenbidi yoga_library
36- defines: WITH_RIVE_TEXT=1 WITH_RIVE_YOGA=1 WITH_RIVE_LAYOUT=1 WITH_RIVE_TOOLS=1
36+ defines: WITH_RIVE_TEXT=1 WITH_RIVE_YOGA=1 WITH_RIVE_LAYOUT=1
3737 appleFrameworks: CoreText
3838 searchpaths: include
3939
Original file line number Diff line number Diff line change @@ -197,9 +197,27 @@ YOGA_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) {
197197 return node;
198198}
199199
200+ namespace {
201+ struct YogaWrapperWithCleanup {
202+ YogaWrapperWithCleanup ()
203+ : defaultConfig (YGConfigNew())
204+ {
205+ }
206+
207+ ~YogaWrapperWithCleanup () {
208+ if (defaultConfig != nullptr ) {
209+ YGConfigFree (defaultConfig);
210+ defaultConfig = nullptr ;
211+ }
212+ }
213+
214+ YGConfigRef defaultConfig = nullptr ;
215+ };
216+ } // namespace
217+
200218YOGA_EXPORT YGConfigRef YGConfigGetDefault () {
201- static YGConfigRef defaultConfig = YGConfigNew ();
202- return defaultConfig;
219+ static YogaWrapperWithCleanup defaultWrapper = YogaWrapperWithCleanup ();
220+ return defaultWrapper. defaultConfig ;
203221}
204222
205223YOGA_EXPORT YGNodeRef YGNodeNew (void ) {
Original file line number Diff line number Diff line change 2929 version: 2.0.1
3030 name: A portable layout engine targeting web standards
3131 description: A portable layout engine targeting web standards.
32- website: https://www.zlib.net/
32+ website: https://github.com/facebook/yoga
3333 license: Public Domain
3434
3535 searchpaths: upstream
You can’t perform that action at this time.
0 commit comments