altmp / altv-issues

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

Client crashes when changing webview.size (when rendered on game object) #2050

Open edgarasx opened 1 year ago

edgarasx commented 1 year ago

Description of the problem

Client crashes when rendering webview on game object and then changing the webviews size.

Reproduction steps

const data = {
    model: alt.hash('v_ilev_cin_screen'),
    texture: 'script_rt_cinscreen',
    url: 'https://altv.mp',
    pos: new alt.Vector3(181.291183, 6417.944, 33.3),
    rot: new alt.Vector3(0, 0, -2.01),
    range: 30,
};

const localObject = new alt.LocalObject(data.model, data.pos, data.rot, true, false);
localObject.frozen = true;
localObject.lodDistance = data.range;

await localObject.waitForSpawn(60_000);

const webview = new alt.WebView(data.url, data.model, data.texture);
webview.size = new alt.Vector2({ x: 1280, y: 720 }); // Commenting out this line will prevent the crash

alt.setTimeout(() => {
    alt.log('destroy');

    webview.destroy();
    localObject.destroy();
}, 10 * 1000);

Expected behaviour

Should not crash

Additional context

Sometimes the client crashes right away, sometimes a weird texture appears instead of webview

Screenshot_33

Operating system

Windows 10

Version

15.0-rc21

Crashdump ID

a1cd378b-13f0-4532-87c9-ba08ac1a2cef

Reproduction tested

Iamproplayer7 commented 1 year ago

Still could be reproduced in 15.0-dev807.

const webview = new alt.WebView('url: does not matter which link', alt.hash('v_ilev_cin_screen'), 'script_rt_cinscreen');
webview.size = new alt.Vector2({ x: 1280, y: 720 });

Game crashes in few seconds of code execution.

Iamproplayer7 commented 1 year ago

Currently can be fixed by editing script_rt_cinscreen texture size into 1280x720. Default is 512x256. When alt.WebView loads texture, webview gets texture size automatically and you don't need use webview.size setter.

v_ilev_cin_screen.zip

We are still waiting for the fix in release branch.