Crash in Unreal UJSBSimMovementComponent::DeInitializeJSBSim() #1346
Replies: 6 comments 2 replies
-
|
In the editor, no matter how you switch levels, I use the open level blueprint function to switch levels, and it won't crash. As long as it is packaged and output as an EXE, running the switch level will crash. I found that if you comment out the delete Exec, it won't crash, but I'm afraid it will cause memory leaks. So, is there a problem with my usage or should I set something up? |
Beta Was this translation helpful? Give feedback.
-
|
You can move the Exec part to the bottom and everything seems to work. Like this: if (Exec)
{
Atmosphere = nullptr;
Winds = nullptr;
FCS = nullptr;
MassBalance = nullptr;
Propulsion = nullptr;
Aircraft = nullptr;
Propagate = nullptr;
Auxiliary = nullptr;
Inertial = nullptr;
Aerodynamics = nullptr;
GroundReactions = nullptr;
Accelerations = nullptr;
IC = nullptr;
delete Exec;
Exec = nullptr;
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Add to TickComponent and try this out, I've also run into a crash |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for responding, my friend, but unfortunately, following your method still results in a crash.
…------------------ 原始邮件 ------------------
发件人: "JSBSim-Team/jsbsim" ***@***.***>;
发送时间: 2025年10月10日(星期五) 中午1:33
***@***.***>;
***@***.******@***.***>;
主题: Re: [JSBSim-Team/jsbsim] This issue is due to a memory leak in the JSBSimMovementComponent.cpp file of jsbsim. The delete Exec; statement is causing a crash when the level is switched after packaging and exporting. Commenting out the delete Exec; statement resolves the issue? (Discussion #1346)
Add to TickComponent
if (!JSBSimInitialized || !Exec || !FCS) { return; }
and try this out, I've also run into a crash
`
if (JSBSimInitialized)
{
JSBSimInitialized = false;
if (Exec) { Aircraft = nullptr; IC = nullptr; Propulsion = nullptr; MassBalance = nullptr; Propagate = nullptr; Auxiliary = nullptr; Aerodynamics = nullptr; Inertial = nullptr; FCS = nullptr; delete Exec; Exec = nullptr; }
}`
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
One thing left to fix: everywhere you use pointers you should check they’re not null before using them. I usually do that by adding an IsValid()-style helper to the class and calling it where needed. For example: There’s at least one place where a pointer is being dereferenced without a check - please review each function that uses these pointers and add the validation. P.S. I hope you are working with JSBSim through C++ only? Not through blueprints. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
This issue is due to a memory leak in the JSBSimMovementComponent.cpp file of jsbsim. The delete Exec; statement is causing a crash when the level is switched after packaging and exporting. Commenting out the delete Exec; statement resolves the issue?
void UJSBSimMovementComponent::DeInitializeJSBSim()
{
if (JSBSimInitialized)
{
UE_LOG(LogJSBSim, Display, TEXT("DeInitializeJSBSim"));
}
}
I need to manually comment out delete Exec; to prevent the crash, but I suspect it may affect other issues, such as memory leaks.
My English is not good, please forgive me.
Beta Was this translation helpful? Give feedback.
All reactions