dl5di / OpenDV

Open Digital Voice software for Amateur Radio based on Jonathan Naylor's (G4KLX) "ircDDBGateway" and "PCRepeaterController" for D-Star
GNU General Public License v2.0
107 stars 63 forks source link

Eliminate the usage of the wxString::Clone() method. #73

Closed mcdermj closed 8 years ago

mcdermj commented 8 years ago

The wxString::Clone() method was added to a few functions to make the code more thread safe. The method does a deep copy of the string so that multiple threads are not referring to the same data.

Unfortunately, wxString::Clone() was not added until wxWidgets 2.9. The default wxWidgets included with at least Ubuntu 15.10 is 2.8.12. It's the same on Raspbian on the Raspberry Pi. This means that this code will not compile with the default packages on these systems. It may not even run correctly.

This patch replaces the calls to wxString::Clone() with wxString(string.c_str()) instead. This creates a c_string and creates a new object. This isn't optimal, especially since it will not handle strings with embedded nulls, but I don't think this will be a problem in our code for these.

mcdermj commented 8 years ago

I tested this very lightly, but it does compile and run. Others will probably want to review before it's merged for good.

F4FXL commented 8 years ago

Hi

As said in other PR. This code shall be compiled against wx3.0. Wx 2.x is obsolete. BTW there are many places in the code where clone will replace "home made deep copy code".

73 Geoffrey F4FXL / KC3FRA

mcdermj commented 8 years ago

No, that's fine. I see my mistake now. On the initial look it seemed as if Raspbian and Ubuntu were still on 2.8 packages, but I've got both 3.0 and 2.x installed, but only the 2.8-dev packages installed. What a pain.

mcdermj commented 8 years ago

Incidentally, if that's the case, I'll set the autoconf stuff to reject wxWidgets versions < 3.0.

F4FXL commented 8 years ago

Hi

I think that would be the best approach. Will you close thid PR then? BTW thank you for your efforts ☺.

mcdermj commented 8 years ago

Done.

BTW. I'm still working on a CI setup for Windows. I've just had a lot of other things on my plate.

F4FXL commented 8 years ago

One thing at a time :D. I think having all projects build system the same is also very important.

SpudGunMan commented 8 years ago

Thanks a ton for the work on this!! I have also sent you a email about a dev email group.

We only have analog repeater and dummy repeater as part of the major applications that could still use this treatment. priority to dummy repeater.