Successful Build, Run-time Crash

beastwick

New Member
Hi everyone,

I was able to use cmake-gui on Windows to generate a working solution. It compiles fine, but when I run Obs I get an immediate crash with:

Debug Assertion Failed!

File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp Line: 888
Expression: _CrtlsValidHeapPointer(block)

Stack Trace:

ntdll.dll!_RtlpBreakPointHeap@4() Unknown
ntdll.dll!RtlpValidateHeapEntry() Unknown
ntdll.dll!RtlValidateHeap() Unknown
KernelBase.dll!_HeapValidate@12() Unknown
ucrtbased.dll!__CrtIsValidHeapPointer() Unknown
ucrtbased.dll!__tolower() Unknown
ucrtbased.dll!__free_dbg() Unknown
> obs32.exe!operator delete(void * block) Line 17 C++
obs32.exe!std::_Deallocate(void * _Ptr, unsigned int _Count, unsigned int _Sz) Line 132 C++
obs32.exe!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned int _Count) Line 721 C++
obs32.exe!std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate(std::_Container_proxy * _Ptr, unsigned int _Count) Line 989 C++
obs32.exe!std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Free_proxy() Line 661 C++
obs32.exe!std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<std::_String_base_types<char,std::allocator<char> > >() Line 629 C++
obs32.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 1018 C++
obs32.exe!std::basic_stringbuf<char,std::char_traits<char>,std::allocator<char> >::str() Line 98 C++
obs32.exe!std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::str() Line 546 C++
obs32.exe!check_path(const char * data, const char * path, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & output) Line 39 C++
obs32.exe!GetDataFilePath(const char * data, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & output) Line 48 C++
obs32.exe!OBSApp::InitLocale() Line 581 C++
obs32.exe!OBSApp::AppInit() Line 791 C++
obs32.exe!run_program(std::basic_fstream<char,std::char_traits<char> > & logFile, int argc, char * * argv) Line 1302 C++
obs32.exe!main(int argc, char * * argv) Line 1815 C++
obs32.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 123 C++
[External Code]

I built using QT 5.7 2015. Deps and QT are 32 bit. This is the 32 bit version of OBS. The same thing happened when I tried 64 bit. Visual Studio 2015.

Also, using the most recent version of Obs from Git.

Any help would be appreciated, I'd like to start hacking on Obs!
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
I can't really make out what's going wrong based upon the debug output. Did you step through it with a debugger to see if perhaps there was a bad parameter passed somewhere along the line? Although with that debug output there really shouldn't be. That's not an area of the program that ever really crashes at all.
 

beastwick

New Member
So I am poking around in the debugger and it is failing here when trying to get the locale, en-US :

obs-app.cpp
static inline bool check_path(const char* data, const char *path,
string &output)
{
ostringstream str;
str << path << data;
output = str.str(); // This operation causes it to choke.

It tries to do this:

platform-windows.cpp:

_Mystr str() const
{ // return string copy of character array
return (_Stringbuffer.str());
}

The stack frame:

‡ std::operator<<<std::char_traits<char> > returned {...} std::basic_ostream<char,std::char_traits<char> > &
‡ std::operator<<<std::char_traits<char> > returned {...} std::basic_ostream<char,std::char_traits<char> > &
+ data 0x012df540 "locale/en-US.ini" const char *
+ output "" std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
+ path 0x012dbff8 "data/obs-studio/" const char *
+ str {_Stringbuffer={_Seekhigh=0x007727b8 "data/obs-studio/locale/en-US.iniýýýýÝÝÝÝùLÍã" _Mystate=5 _Al=allocator } } std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >


This probably isn't an Obs problem, but an environment issue. I'd roll on Linux, but confined to VM for now :( To be specific:

Windows 10
Visual Studio 2015 (free)
QT 5.7 (32 bit)
Built the project with CMAKE

- brian
 

beastwick

New Member
I think there might be a problem with the const char * being written to the ostringstream. Maybe the const char* params need to be converted to a string first. I'm going to try this later tonight.

exp: string (const char* s,size_t n );

Does const char* count as a string object? Docs say that .str requires:
str
A string object, whose content is copied.
 

beastwick

New Member
So I tried a bunch of things and no luck. It basically performs a free operation on the char * whenever I do an operation with it, like concatenating strings, etc.

It ends up in delete_scalar.cpp (windows)

void __CRTDECL operator delete(void* const block) noexcept
{
#ifdef _DEBUG
_free_dbg(block, _UNKNOWN_BLOCK);
#else
free(block);
#endif
}

tries to free a void* const

I've read a bunch of things and 1) the const char * passed was never created with a new, so why is it being freed? 2) If it does have to be free, I'm not sure if it can do it with a void * const. I think it has just be void *.

I'm going to stop here and try to work out working in a Linux environment for this, but if anyone has any insight into this, that would be super helpful. Is anyone else here on Windows 10 and VS2015? I'm working with the 32 bit project.
 
Top