Using std::regex with Linux

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tengai
Earned a small fee
Earned a small fee
Posts: 13
Joined: Fri May 11, 2018 6:49 pm

Using std::regex with Linux

Post by tengai » Wed May 08, 2019 6:03 pm

I seem to have problems with using std::regex with wxWidgest 3.1.2 on Linux. Using std::regex in a EVT_COMMAND handler will crash the app. Switching to boost::regex and there is no problem. Any body know why? This is not a problem with Windows and MS VS version of std::regex.

Using: Cent0S 7 with g++ 4.8.5

Thanks,

Patrick

DavidHart
Site Admin
Site Admin
Posts: 3854
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Using std::regex with Linux

Post by DavidHart » Wed May 08, 2019 6:14 pm

Hi,

It's unlikely to be an issue with std::regex itself. More likely it's revealing a timing-sensitive bug in your program, with e.g. a pointer losing scope and being nulled faster in Linux.

However you can easily check if it's a real std::regex bug: just make a std::regex call elsewhere e.g. in your frame ctor, and see if it crashes there too.

If not, look hard at the event handler; is it called with the correct 'this'? or is it called from a worker thread, and the event contains data that's lost scope?

If all else fails ( :wink: ) try running the program in your debugger...

Regards,

David

Post Reply