altmp / altv-issues

Issues and roadmap for alt:V project
92 stars 17 forks source link

HttpClient won't trigger baseObjectRemove event #2263

Open xLuxy opened 3 months ago

xLuxy commented 3 months ago

Description of the problem

The following code properly calls the baseObjectCreate event, however, when destroying it, using alt::ICore:DestroyBaseObject won't trigger the baseObjectRemove and therefore creates a memory leak in v2 module because it relays on the OnCreateBaseObject / OnRemoveBaseObject methods to cleanup class objects

alt::ICore::Instance().CreateHttpClient(...);

Reproduction steps


alt.on('baseObjectCreate', alt.log);
alt.on('baseObjectRemove', alt.log);

const httpClient = new alt.HttpClient();

// ...

httpClient.destroy();

Expected behaviour

baseObjectRemove event should always be called for BaseObject entities

Additional context

No response

Operating system

Windows 11

Version

16.0.0-dev.300

Crashdump ID

No response

Confirmation of issue's presence