otclient icon indicating copy to clipboard operation
otclient copied to clipboard

After compilation by MinGW, client crashes on stdext::throw_exception

Open djseban opened this issue 6 years ago • 1 comments

Hi there,

I noticed strange thing: function stdext::throw_exception is just simply an inline for throw keyword. When compiling with VS or GCC on Linux, in case of throwing without try/catch block (which is a definition of unhandled exception) we get the output of error in client_terminal. Eg. if we lack some image in modules, we get output like this: ERROR: Unable to load texture '/images/our_image': unable to open file '/images/our_image': not found That theoretically shouldn't happen, since function readFileContents ` std::string fullPath = resolvePath(fileName);

PHYSFS_File* file = PHYSFS_openRead(fullPath.c_str());
if(!file)
    stdext::throw_exception(stdext::format("unable to open file '%s': %s", fullPath, PHYSFS_getLastError()));

int fileSize = PHYSFS_fileLength(file);
std::string buffer(fileSize, 0);
PHYSFS_read(file, (void*)&buffer[0], 1, fileSize);
PHYSFS_close(file);

return buffer;`

doesn't have try/catch block, therefore it is an unhandled exception. The problem is, when you compile the client with MinGW toolset, it actually crashes in case of the lacking file. My question is: is this the intended behavior of all this or there is function that handles these exceptions somewhere?

djseban avatar Feb 13 '19 15:02 djseban

@djseban , i haven't tried building in codeblocks for windows, but recently builded in windows using VS2017 and i had to place some DLL by hand coz they weren't building. ok... on linux it was flawless..

well to answer you question: No, this shouldn't be the intended behaviour, building the software should be seamless but i think this repo is deserted.

VagnerDomingues avatar Feb 13 '19 23:02 VagnerDomingues