mehah / otclient

An alternative tibia client for otserv written in C++20 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
242 stars 177 forks source link

Random crashes #777

Closed xrddw126 closed 1 month ago

xrddw126 commented 1 month ago

Priority

High

Area

What happened?

I noticed that the method:

void DrawPoolManager::addTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src, const Color& color, const DrawConductor& condutor) const

For some reason it randomly crashes the client, interestingly this happens not on all but only some processors, but on more powerful ones log.txt

What OS are you seeing the problem on?

Windows

Code of Conduct

mehah commented 1 month ago

there is no getTexture in creatureInformation, is this custom code?

https://github.com/mehah/otclient/blob/fd8799e59115ef0cba65732e50b4c4025064599b/src/client/creature.cpp#L127

Note: If so, you cannot request getTexture within this method, there may be competition with lua since it is executed asynchronously between UI and Map

xrddw126 commented 1 month ago

Yes, I wanted to add additional icons next to the life bars. Ok, thanks. Will try to do as you say

mehah commented 1 month ago

@xrddw126 @patrykq112

put "/" at the beginning of Path so as not to make a lua call.

like this:

g_textures.getTexture('images/xyz/item.png');
to
g_textures.getTexture('/images/xyz/item.png');
mehah commented 1 month ago

I will close this issue as it is not a project problem.

patrykq112 commented 1 month ago

@mehah For me, crashes occur on a clean project. The client closes randomly, no error or crash report appears

mehah commented 1 month ago

@mehah For me, crashes occur on a clean project. The client closes randomly, no error or crash report appears

Run it directly through Visual Studio so it displays the error when it occurs.

patrykq112 commented 1 month ago

@mehah image image image image

patrykq112 commented 1 month ago

this bug occurs after "fix: crash with getTexture inside preDraw" commit.

mehah commented 1 month ago

@patrykq112

test plz: https://github.com/mehah/otclient/pull/782