Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.0.2</Version>
<Version>10.0.3</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
10 changes: 8 additions & 2 deletions src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ const hackJSDestroyPlugin = function () {
JSVideoPlugin = null;
delete window.JSVideoPlugin;
removePlugin();

return new Promise((resolve, reject) => {
resolve();
});
}
}

Expand Down Expand Up @@ -345,19 +349,21 @@ export function stopRealPlay(id) {

export function dispose(id) {
const vision = Data.get(id);
Data.remove(id);

const { realPlaying, logined, observer } = vision;
if (observer) {
observer.disconnect();
}
WebVideoCtrl.I_HidPlugin();

if (realPlaying === true) {
stopRealPlay(id);
}
if (logined === true) {
logout(id);
}
Comment on lines 358 to 363
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dispose function calls async functions stopRealPlay(id) and logout(id) without awaiting them. This creates a race condition where WebVideoCtrl.I_DestroyPlugin() and Data.remove(id) may execute before the stop/logout operations complete, potentially causing resource leaks or errors.

Consider making dispose async and awaiting these operations:

export async function dispose(id) {
    const vision = Data.get(id);
    const { realPlaying, logined, observer } = vision;
    if (observer) {
        observer.disconnect();
    }
    WebVideoCtrl.I_HidPlugin();

    if (realPlaying === true) {
        await stopRealPlay(id);
    }
    if (logined === true) {
        await logout(id);
    }
    WebVideoCtrl.I_DestroyPlugin();

    Data.remove(id);
}

Copilot uses AI. Check for mistakes.
WebVideoCtrl.I_DestroyPlugin();

Data.remove(id);
}

const getTagNameFirstValue = (xmlDoc, tagName, defaultValue = '0') => {
Expand Down
Loading