TSet class member causes EXCEPTION_ACCESS_VIOLATION

Hi,

I have a TSet private variable as part of a plugin IModuleInterface derived class:

TSet<int32> NotificationFilters;

I call the Add() in one of the class methods which causes the engine to crash:

NotificationFilters.Add(Index);

I have read on the forum that this is due to the unreal garbage collector and recommending adding UPROPERTY() in front of the declaration. I have not seen anyone mention how this would be done for a plugin.

Can you use GENERATED_BODY() / UCLASS() / UPROPERTY() with a plugin class?

Is there another fix so I can use TSet or TArray in a plugin class?

Thanks,

Sava

I have a pretty extensive collection of modules in my project, and not a one of them has any class scope properties. The functions inside the classes are all static, so you wouldn’t be able to access them anyway. You probably can’t get to UClass / UProp features from there. Including containers.

what are you trying to do overall?

I have a bunch of checkbox widgets and would like to store which checkboxes are checked as opposed to running IsChecked() on each one every time I need that information.

I don’t know what I did but it started working. Sorry to anyone else runs into this issue but I have no idea what I did. Here is the link to the plugin repo: https://github.com/sava41/UnrealEmailAlerts

I was having a similar issue but I realized my mistake. I was iterating over a TSet using C++'s ranged-for feature and calling a function using the set value as an argument. I didn’t realize that the function was also calling Add() on the same set that I was iterating on.

So essentially I had a situation like this:

	TSet<int32> A;
	A.Add(0);

	for (int32 Value : A)
	{
		A.Add(Value);
	}

This causes the engine to crash with an EXCEPTION_ACCESS_VIOLATION. Not sure if that was related to your problem but maybe it helps someone else who finds this post in the future.