You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirmed that this is a bug. I think that the EGS_SimpleApplication has been broken at some point. Right now I don't have a work-around, aside from just using tutor2 instead of tutor2pp.
I've been encountering the same thing when making my own usercode that inherits from EGS_SimpleApplication. I've found that I simply have to remove line 204 from egs_simple_application.cpp, currently reading
delete source_input;
to avoid this seg fault. Not sure what line 200 is doing with createSource(...) but it seems to be clobbering the pointer.
Reason for the bug: createSource calls EGS_Object *EGS_ObjectFactory::createObjects(EGS_Input *i,... where i is passed to the local EGS_input pointer input, which is deleted at the end of createObject.
There are two ways of fixing the segfault error:
Pass a copy of EGS_Input *i in the argument of createObjects
In line 204 of egs_simple_application.cpp use if (source_input) delete source input`
I think option 1 is more intentional, explicitly stating: "I am intentionally passing a copy of the EGS_Input object and taking care of the original version here ..." while option 2 is more cautious, implying lack of knowing what is actually going on.
Describe the bug
Segmentation fault in tutor2pp
To Reproduce
Expected behavior

(from tutor2)
Screenshots

Operating system
EGSnrc version
v2023b
Additional context
tutor2pp.zip
The text was updated successfully, but these errors were encountered: