Closed jiwoong-choi closed 6 years ago
Your topics are getting garbage collected and thus unsubscribe automatically. Put UPROPERTY() before class UTopic *ExampleTopic; and it should no longer happen.
Now it works perfectly fine. Thank you so much!
Your topics are getting garbage collected and thus unsubscribe automatically. Put UPROPERTY() before class UTopic *ExampleTopic; and it should no longer happen.
may i know the GC rules here? why this member pointer is GCed?
thanks.
First of all, thank you for sharing the great plugin.
I have slightly modified the C++ publish / subscribe examples in the Readme.md.
After setting up & build the plugin, I have created two C++ Actor classes called, Publisher and Subscriber. In UE4Editor, I have added each class to the level editor by drag & drop. Basically, the idea is that Publisher publishes a string message at each frame to the example_topic, and Subscriber listens to the example_topic and prints out what it heard to the console.
Every time I run the game in UE4Editor, everything works perfectly for the first 1 minute. However, some point after a minute, UE4Editor crashes with the following error message:
The crash occurs at different frame number every time I try.
I was able to prevent UE4Editor from crashing by setting
in the Publisher.h below. (i.e. by not publishing any message) But I still get the following message
I've never called ROSBridge::UnregisterTopicCallback in my code, but somehow it is called and causes the Subscriber to unsubscribe from the topic. So I tried to modify some parts of the plugin code, but it didn't go anywhere.
I've been fighting with this more than 6 hours but have no idea to fix it. Please help me!
Here are my codes.
Publisher.h:
Publisher.cpp:
Subscriber.h:
Subscriber.cpp: