SAMPProjects / Open-SAMP-API

An open source API for GTA SA:MP
GNU Lesser General Public License v3.0
63 stars 15 forks source link

safeExecuteWithValidation raising SAMP-Exception dialog #35

Open ghost opened 7 years ago

ghost commented 7 years ago

E.g. WRITE(int(Utils::SafeBlock::safeExecuteWithValidation([&](){ Rendering::Renderer::sharedRenderer().getAs<Rendering::Box>(id)->setBoxHeight(height); })));

id is invalid, a nullptr is returned and is used. Normally the try/catch should get it, but SAMP raise an exception dialog before. The game is running and not crashed, so the safeExecuteWithValidation works.

Bug

agrippa1994 commented 7 years ago

Is this bug reproducible? If the exception is caught by the exception handler, then it must be somewhere else. Maybe the WRITE macro itself fails ...

ghost commented 7 years ago

https://github.com/shadowlif/Open_SAMP_API_ReproduceableCrash (also as Release) Maybe it's crashing because of an missing mutex here https://github.com/SAMPProjects/Open-SAMP-API/blob/master/src/Open-SAMP-API/Game/Rendering/Renderer.cpp#L38

agrippa1994 commented 7 years ago

That might be a reason because C++ STL containers are not thread safe. Does it still crash if you add the missing mutex there?

ghost commented 7 years ago

Nope, also I thought about it. Is safeExecuteWithValidation even catching an exception? Maybe not because SAMP set the UnhandledExceptionHandler.