altmp / altv-issues

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

JS | registerPedheadshot / registerPedheadshot3 crashing game #987

Closed Revyn112 closed 3 years ago

Revyn112 commented 3 years ago

Client/server version

Build #4.0.rc-1

Current behavior Using native registerPedheadshot or registerPedheadshot3 is crashing the client sometimes.

Expected behavior Client shouldn't crash.

Steps to reproduce

    const pedHeadshotHandle = natives.registerPedheadshot3(pedId);
    let attempts = 0;

    const interval = alt.setInterval(() => {
        if (natives.isPedheadshotReady(pedHeadshotHandle) && natives.isPedheadshotValid(pedHeadshotHandle)) {
            pedHeadshot = alt.getHeadshotBase64(pedHeadshotHandle);
            natives.unregisterPedheadshot(pedHeadshotHandle);
            alt.clearInterval(interval);
        }

        attempts++;
        if (attempts >= 20) {
            attempts = 0;
            natives.unregisterPedheadshot(pedHeadshotHandle);
            alt.clearInterval(interval);
        }
    }, 100);

Context (environment) Using the pedheadshot for cef ui. Crash Dump attached.

altv_4.0-rc1_Social Club_0xa2b23c_28-06-2021_01-59-04.zip

deluvas1911 commented 3 years ago

Crash also happens with native registerPedheadshotTransparent

C0kkie commented 3 years ago

Fixed since dev/4.0-dev14