[BUG] Copy constructor of ChSystem is unusable

14 views
Skip to first unread message

Geoffroy ALEXANDRE

unread,
Jan 17, 2023, 7:26:44 AM1/17/23
to ProjectChrono
Hello,
I ran into a crash when attempting to use the copy constructor of a ChSystem, and I found the reason why in ChSystem.cpp.

if using something like :
ChSystemNSC* copied_sys = new ChSystemNSC(original);

The copy constructor calls the function SetTimestepperType (line 108).
In this function we test if the timestepper type is the same as the one we want to set by comparing it with GetTimestepperType (line 461), which is simply calling copied_sys->timestepper->GetType(), without any kind of check.
This produces a crash, as the timestepper for this is empty at this point.

I'm sorry I'm not familiar enough with GitHub to open an issue there, but I still wanted to report this.

Radu Serban

unread,
Jan 17, 2023, 7:29:35 AM1/17/23
to ProjectChrono

Hi Geoffroy,

 

Thank you for reporting this.  I’ll look into it and provide a fix.

 

--Radu

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/d7d7fb38-f36c-486f-84ed-e97db413e2d6n%40googlegroups.com.

Radu Serban

unread,
Jan 17, 2023, 4:03:50 PM1/17/23
to ProjectChrono

I pushed a fix for this.  Please let us know if you find any other issues.

Thanks,
Radu

Reply all
Reply to author
Forward
0 new messages