-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fix threading issues capturing log messages as breadcrumbs #559
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,26 @@ SentryScopeDesktop::SentryScopeDesktop() | |
{ | ||
} | ||
|
||
SentryScopeDesktop::SentryScopeDesktop(const SentryScopeDesktop& Scope) | ||
{ | ||
Dist = Scope.Dist; | ||
Environment = Scope.Environment; | ||
FingerprintDesktop = Scope.FingerprintDesktop; | ||
TagsDesktop = Scope.TagsDesktop; | ||
ExtraDesktop = Scope.ExtraDesktop; | ||
ContextsDesktop = Scope.ContextsDesktop; | ||
BreadcrumbsDesktop = Scope.BreadcrumbsDesktop; | ||
LevelDesktop = Scope.LevelDesktop; | ||
} | ||
|
||
Comment on lines
+20
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this coming from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's essential to implement a custom copy constructor for the scope class after we've introduced a critical section member. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL. Thanks! |
||
SentryScopeDesktop::~SentryScopeDesktop() | ||
{ | ||
} | ||
|
||
void SentryScopeDesktop::AddBreadcrumb(USentryBreadcrumb* breadcrumb) | ||
{ | ||
FScopeLock Lock(&CriticalSection); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's neat, that it works like that. |
||
|
||
BreadcrumbsDesktop.Add(StaticCastSharedPtr<SentryBreadcrumbDesktop>(breadcrumb->GetNativeImpl())); | ||
} | ||
|
||
|
@@ -264,7 +278,7 @@ void SentryScopeDesktop::Apply(USentryEvent* event) | |
sentry_value_incref(nativeBreadcrumb); | ||
sentry_value_append(eventBreadcrumbs, nativeBreadcrumb); | ||
} | ||
|
||
sentry_value_set_by_key(nativeEvent, "breadcrumbs", eventBreadcrumbs); | ||
} | ||
else | ||
|
@@ -279,4 +293,11 @@ void SentryScopeDesktop::Apply(USentryEvent* event) | |
} | ||
} | ||
|
||
void SentryScopeDesktop::AddBreadcrumb(TSharedPtr<SentryBreadcrumbDesktop> breadcrumb) | ||
{ | ||
FScopeLock Lock(&CriticalSection); | ||
|
||
BreadcrumbsDesktop.Add(breadcrumb); | ||
} | ||
|
||
#endif |
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.
If we're no longer using the "plain"
AddBreadcrumb
, do we need it?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.
It's still a part of the public API so I think we should leave it even though we're not using it internally anymore.