UnrealInk icon indicating copy to clipboard operation
UnrealInk copied to clipboard

Plugin crashes

Open metamorphium opened this issue 4 years ago • 2 comments

Hi David, thanks a lot for this plugin. I am encountering infrequent desktop crashes originating in the plugin. The crashes are in UStory::ChoosePathString while invoking MonoInvoke:

inline void MonoInvoke<void>(FString MethodName, void** params)
{
	FInkModule& Ink = FModuleManager::GetModuleChecked<FInkModule>("Ink");

	MonoObject* Exception;
	mono_runtime_invoke(Methods[MethodName], Instance, params, &Exception);
	Ink.MaybeThrowMonoException(Exception);
}

I was trying to track down the crash and eventually, it leads me to think that it might be UE4 Garbage Collector, collecting probably(?) TMap, which is not marked as UPROPERTY() This would explain to me the randomness in which the class crashes.

I was going through the Minidump, but couldn't pinpoint the issue better than this.

Any idea, if Methods could be marked for non-deletion or UPROPERTized?

I thought of wrapping MonoMethod into USTRUCT so it could be markable, but I am not sure if this would be the right way.

Thanks, Jan

metamorphium avatar Apr 11 '21 17:04 metamorphium

Hello! Did you find a solution for this?

Peppercat3120 avatar Nov 28 '23 16:11 Peppercat3120

I also suffered from the same symptoms of seemingly-random crashes. This did seem to come from the TMap being cleared, but it looks like the UCLASS that held the TMap was being garbage collected.

I had something like

UCLASS()
class UStoryDriver {
...
UStory* story;
...
};

After placing a UPROPERTY() above the UStory member variable, I stopped having issues.

So for the wandering travelers also experiencing this, I'd say check this first.

KadynCBR avatar Dec 16 '23 08:12 KadynCBR