openframeworks / openframeworks/openFrameworks
Crash when saving ofXml on exit() callback
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
On VisualStudio 2015 WIN 10 here;
A simple ofApp that tries to save an ofXml on exit() crashes somewhere in boost;
Unhandled exception thrown: read access violation.
this->_Ptr->_Facetvec was 0x111011101110111.
BaseApp_debug.exe!std::locale::_Getfacet(unsigned __int64 _Id) Line 459 C++
BaseApp_debug.exe!std::use_facet<std::codecvt<wchar_t,char,_Mbstatet> >(const std::locale & _Loc) Line 564 C++
BaseApp_debug.exe!boost::filesystem::path::codecvt() Line 904 C++
BaseApp_debug.exe!boost::filesystem::path_traits::convert(const char * from, const char * from_end, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & to) Line 837 C++
BaseApp_debug.exe!boost::filesystem::path_traits::dispatch<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & c, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & to) Line 256 C++
BaseApp_debug.exe!boost::filesystem::path::path<char [9]>(const char[9] & source, void * __formal) Line 140 C++
BaseApp_debug.exe!ofApp::exit() Line 15 C++
BaseApp_debug.exe!ofBaseApp::exit(ofEventArgs & args) Line 72 C++
BaseApp_debug.exe!ofEvent<ofEventArgs,std::recursive_mutex>::make_function::__l2::<lambda>(const void * __formal, ofEventArgs & t) Line 440 C++
[External Code]
BaseApp_debug.exe!of::priv::Function<ofEventArgs,std::recursive_mutex>::notify(const void * s, ofEventArgs & t) Line 90 C++
BaseApp_debug.exe!ofEvent<ofEventArgs,std::recursive_mutex>::notify(const void * sender, ofEventArgs & param) Line 524 C++
BaseApp_debug.exe!ofNotifyEvent<ofEvent<ofEventArgs,std::recursive_mutex>,ofEventArgs,ofMainLoop>(ofEvent<ofEventArgs,std::recursive_mutex> & event, ofEventArgs & args, ofMainLoop * sender) Line 210 C++
BaseApp_debug.exe!ofMainLoop::exit() Line 169 C++
BaseApp_debug.exe!ofExitCallback() Line 235 C++
The code is super simple:
class ofApp : public ofBaseApp{
public:
void exit() {
ofXml s;
s.save("test.xml");
}
}
Saving the xml is totally fine when I attempt to do it while the app is running; so it must be something related to the exit() call;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash on Visual Studio 2015 and Windows 10 with the shown ofApp::exit() example. Trace ofXml::save() through ofBaseApp::exit() and ofMainLoop::exit(), using the reported Boost filesystem and locale stack as the starting point. Done means saving test.xml from exit() no longer crashes while saving during normal runtime still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100