-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't add new ref to the System instance which is being destroyed (fix aseprite/aseprite#4811) #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
SystemRef System::instance() | ||
{ | ||
ASSERT(!g_is_being_destroyed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "ASSERT" is directly included [misc-include-cleaner]
os/common/system.cpp:7:
- #ifdef HAVE_CONFIG_H
+ #include "base/debug.h"
+ #ifdef HAVE_CONFIG_H
@@ -66,6 +66,9 @@ | |||
|
|||
namespace os { | |||
|
|||
// Extern raw reference to current system instance. | |||
extern System* g_instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "os::System" is directly included [misc-include-cleaner]
os/win/window.cpp:7:
- #ifdef HAVE_CONFIG_H
+ #include "os/system.h"
+ #ifdef HAVE_CONFIG_H
d2b3274
to
4b7d7d1
Compare
Hi there! One or more of the commit messages in this PR do not match our code submission policy, please check the |
Just in case, this can be tested with the new |
My bad, the bug is reproducible with the editor_benchmark: https://github.com/aseprite/aseprite/blob/beta/src/app/editor_benchmark.cpp |
After some @martincapello testing, other issues were found but we weren't able to reproduce the bug again. I'll merge this PR as it is as at least is a real mitigation of Sentry crash reports from aseprite/aseprite#4811. |
…prite#4811) Regression introduced in 3bea531, when os::instance() was refactored to os::System::instance() to return a SystemRef instead of a System*, and ~WindowWin() destructor asks for the current system() (and WindowWin::system() is trying to create a new System reference, but the System is being destroyed as it was completely unreferred, i.e. ref=0.)
4b7d7d1
to
d3c48fc
Compare
Hi there! One or more of the commit messages in this PR do not match our code submission policy, please check the |
Regression introduced in 3bea531, when os::instance() was refactored to os::System::instance() to return a SystemRef instead of a System*, and ~WindowWin() destructor asks for the current system() (and WindowWin::system() is trying to create a new System reference, but the System is being destroyed as it was completely unreferred, i.e. ref=0.)