mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
92749d9a76
The dynamic linker is already taking care of this for us. Now that crt0 is statically linked into each executable and shared library this breaks things because initializers are invoked twice. Before this PR this didn't crash because crt0 and its _start() function was contained in LibC and thus only LibC's initializers were invoked several times which wasn't as much of a problem because these initializers didn't have any side effects (such as malloc/free). However, user programs are more likely to have constructors with side effects, e.g.: std::string g_test("hello!"); This would allocate memory when the constructor is invoked. When it is invoked again the original allocation would be leaked and another copy of the string would get allocated. Worse still, when the destructors are invoked twice the memory would get free'd twice which would likely crash the program. |
||
---|---|---|
.. | ||
Applets | ||
Applications | ||
Demos | ||
DevTools | ||
DynamicLoader | ||
Games | ||
Libraries | ||
Services | ||
Shell | ||
Tests | ||
Utilities | ||
CMakeLists.txt |