Skip to content

Commit

Permalink
Fix build errors in older engine versions (#428)
Browse files Browse the repository at this point in the history
* Fix build errors in older engine version

* Add older engine version to CI build

* Update versions list

* Update changelog

* Exclude configs which are breaking for older engine versions

* Revert CI changes

* Fix changelog
  • Loading branch information
tustanivsky authored Oct 27, 2023
1 parent ccb4a79 commit 72dedd8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fix invalid breadcrumbs level for Win/Linux ([#426](https://github.com/getsentry/sentry-unreal/pull/426))
- Fix build errors in UE4 ([#428](https://github.com/getsentry/sentry-unreal/pull/428))
- Fix iOS build errors ([#429](https://github.com/getsentry/sentry-unreal/pull/429))

## 0.12.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ FSentryCrashContext::FSentryCrashContext(TSharedPtr<FSharedCrashContext> Context
{
}

FSentryCrashContext FSentryCrashContext::Get()
TSharedPtr<FSentryCrashContext> FSentryCrashContext::Get()
{
TSharedPtr<FSharedCrashContext> SharedCrashContext = MakeShareable(new FSharedCrashContext);
FGenericCrashContext::CopySharedCrashContext(*SharedCrashContext);

return FSentryCrashContext(SharedCrashContext);
return MakeShareable(new FSentryCrashContext(SharedCrashContext));
}

void FSentryCrashContext::Apply(TSharedPtr<SentryScopeDesktop> Scope)
Expand Down Expand Up @@ -66,12 +66,14 @@ void FSentryCrashContext::Apply(TSharedPtr<SentryScopeDesktop> Scope)

FString FSentryCrashContext::GetGameData(const FString& Key)
{
const FString* GameDataItem = nullptr;
const FString* GameDataItem;

#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3
GameDataItem = FGenericCrashContext::GetGameData().Find(Key);
#else
#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 3
GameDataItem = FGenericCrashContext::GetGameData(Key);
#else
GameDataItem = nullptr;
#endif

return GameDataItem != nullptr ? *GameDataItem : FString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct FSentryCrashContext : public FGenericCrashContext
FSentryCrashContext(TSharedPtr<FSharedCrashContext> Context);

public:
static FSentryCrashContext Get();
static TSharedPtr<FSentryCrashContext> Get();

void Apply(TSharedPtr<SentryScopeDesktop> Scope);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SentryCrashReporter::SentryCrashReporter()
{
crashReporterConfig = MakeShareable(new FJsonObject);

const FString sentryData = FSentryCrashContext::Get().GetGameData(TEXT("__sentry"));
const FString sentryData = FSentryCrashContext::Get()->GetGameData(TEXT("__sentry"));
if(!sentryData.IsEmpty())
{
const TSharedRef<TJsonReader<>> jsonReader = TJsonReaderFactory<>::Create(*sentryData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sentry_value_t HandleBeforeCrash(const sentry_ucontext_t *uctx, sentry_value_t e
{
SentrySubsystemDesktop* SentrySubsystem = static_cast<SentrySubsystemDesktop*>(closure);

FSentryCrashContext::Get().Apply(SentrySubsystem->GetCurrentScope());
FSentryCrashContext::Get()->Apply(SentrySubsystem->GetCurrentScope());

return HandleBeforeSend(event, nullptr, closure);
}
Expand Down
4 changes: 4 additions & 0 deletions sample/Source/SentryPlayground.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ public SentryPlaygroundTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.Latest;

#if UE_5_1_OR_LATER
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif

ExtraModuleNames.AddRange( new string[] { "SentryPlayground" } );
}
}
4 changes: 4 additions & 0 deletions sample/Source/SentryPlaygroundEditor.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ public SentryPlaygroundEditorTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.Latest;

#if UE_5_1_OR_LATER
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif

ExtraModuleNames.AddRange( new string[] { "SentryPlayground" } );
}
}

0 comments on commit 72dedd8

Please sign in to comment.