[UE5.4, crash] A crash from AudioCaptureCore.

https://drive.google.com/file/d/10M5GBvoOwEGJg6c2zEoAtJtVi3tX5JNj/view?usp=sharing

steps to reproduce:

  1. generate project file and open the project in IDE.
  2. compile it.
  3. open the project in unreal editor.
  4. it will crash during unreal editor is opening.

stack trace:

2024-04-29 01:09:37.305 UnrealEditor[89905:6419225] [UE] [2024.04.28-17.09.37:305][  0]LogMac: === Critical error: ===
SIGSEGV: invalid attempt to access memory at address 0x0

2024-04-29 01:09:37.305 UnrealEditor[89905:6419225] [UE] [2024.04.28-17.09.37:305][  0]LogMac: 0xfa9c3ee4 UnrealEditor-AudioCaptureCore.dylib!Audio::FAudioCapture::FAudioCapture()   [UnknownFile]) 
0x6f7ae648 UnrealEditor-testAudioCaptureCorePlugin.dylib!UtestAudioCapture::UtestAudioCapture()   [UnknownFile]) 
0x02c04274 UnrealEditor-CoreUObject.dylib!UClass::CreateDefaultObject()   [UnknownFile]) 
0x02c08fa8 UnrealEditor-CoreUObject.dylib!UClass::InternalCreateDefaultObjectWrapper() const   [UnknownFile]) 
0x02a5035c UnrealEditor-CoreUObject.dylib!UClass::GetDefaultObject(bool) const   [UnknownFile]) 
0x03021eb4 UnrealEditor-CoreUObject.dylib!ProcessNewlyLoadedUObjects(FName, bool)   [UnknownFile]) 
0x02ea0e90 UnrealEditor-CoreUObject.dylib!TBaseStaticDelegateInstance<void (FName, bool), FDefaultDelegateUserPolicy>::ExecuteIfSafe(FName, bool) const   [UnknownFile]) 
0x04662e54 UnrealEditor-Core.dylib!void TMulticastDelegateBase<FDefaultDelegateUserPolicy>::Broadcast<IBaseDelegateInstance<void (FName, bool), FDefaultDelegateUserPolicy>, FName, bool>(FName, bool) const   [UnknownFile]) 
0x049b9bfc UnrealEditor-Core.dylib!FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&, ELoadModuleFlags)   [UnknownFile]) 
0x00e59708 UnrealEditor-Projects.dylib!FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, TSizedDefaultAllocator<32>> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapHashableKeyFuncs<FName, EModuleLoadResult, false>>&)   [UnknownFile]) 
0x00e7b4a4 UnrealEditor-Projects.dylib!FPluginManager::TryLoadModulesForPlugin(FPlugin const&, ELoadingPhase::Type) const   [UnknownFile]) 
0x00e7ec24 UnrealEditor-Projects.dylib!FPluginManager::LoadModulesForEnabledPlugins(ELoadingPhase::Type)   [UnknownFile]) 
0x007b0a24 UnrealEditor!FEngineLoop::LoadStartupModules()   [UnknownFile]) 
0x007ac4c0 UnrealEditor!FEngineLoop::PreInitPostStartupScreen(char16_t const*)   [UnknownFile]) 
0x0079a22c UnrealEditor!GuardedMain(char16_t const*)   [UnknownFile]) 
0x007b44e8 UnrealEditor!-[UEAppDelegate runGameThread:]   [UnknownFile]) 
0x0480cb98 UnrealEditor-Core.dylib!-[FCocoaGameThread main]   [UnknownFile]) 
0x9b028520 Foundation!__NSThread__start__()   [UnknownFile]) 
0x99e1ef94 libsystem_pthread.dylib!_pthread_start()   [UnknownFile]) 
0x99e19d34 libsystem_pthread.dylib!thread_start()   [UnknownFile]) 

2024-04-29 01:09:37.317 UnrealEditor[89905:6419225] [UE] [2024.04.28-17.09.37:317][  0]LogExit: Executing StaticShutdownAfterError

expect:
no crash.

possible reason:
In file Engine/Source/Runtime/AudioCaptureCore/Private/AudioCaptureInternal.h line 41. GEngine is null and it’s used with verify its value.
UE5.3.2 doesn’t have GEngine->UseSound()

workaround:
replace GEngine->UseSound() with (GEngine != nullptr && GEngine->UseSound())

any help or thought will be appreciated.

1 Like

Similar issue.

@wukakuki @BingoUE

The engine doesn’t seem to be fully initialized while the plugin is loading

You need to push the plugin load phase to a further part where the engine is up and running. (otherwise you are trying to access modules that are not yet loaded)

Switch

“LoadingPhase”: “Default” => “LoadingPhase”: “PostEngineInit”,

inside of testAudioCaptureCorePlugin.uplugin

{
	"FileVersion": 3,
	"Version": 1,
	"VersionName": "1.0.0",
	"FriendlyName": "testAudioCaptureCore Plugin",
	"Description": "testAudioCaptureCore plugin",
	"Category": "Other",
	"CreatedBy": "Siqi.Wu",
	"CreatedByURL": "",
	"DocsURL": "",
	"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/82b9bc3c52e141f383ffa4e88e7b59d8",
	"SupportURL": "",
	"EngineVersion": "5.4.0",
	"CanContainContent": false,
	"Installed": true,
	"Modules": [
		{
			"Name": "testAudioCaptureCorePlugin",
			"Type": "Runtime",
			"LoadingPhase": "PostEngineInit",
			"WhitelistPlatforms": [
				"Win64",
				"Linux",
				"LinuxArm64",
				"Mac",
				"Android",
				"IOS"
			]
		}
	]
}

1 Like

That’s really nice.
My plugin got worked after changing “LoadingPhase”: “Default” => “LoadingPhase”: “PostEngineInit”,

Don’t forget mark my post as the solution :wink: