mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-24 02:09:28 +00:00
LibWeb: Stop the video decoder thread when the video element is GC'd
Otherwise, the thread will continue to run and access the media data buffer, which will have been freed. The test here is a bit strange, but the issue would only consistently repro after several GC runs.
This commit is contained in:
committed by
Andreas Kling
parent
f13ccb9a61
commit
f6407276f7
@@ -15,6 +15,7 @@
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/HTMLVideoElement.h>
|
||||
#include <LibWeb/HTML/VideoTrack.h>
|
||||
#include <LibWeb/HTML/VideoTrackList.h>
|
||||
#include <LibWeb/Layout/VideoBox.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
#include <LibWeb/Platform/ImageCodecPlugin.h>
|
||||
@@ -36,6 +37,14 @@ void HTMLVideoElement::initialize(JS::Realm& realm)
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLVideoElement);
|
||||
}
|
||||
|
||||
void HTMLVideoElement::finalize()
|
||||
{
|
||||
Base::finalize();
|
||||
|
||||
for (auto video_track : video_tracks()->video_tracks())
|
||||
video_track->stop_video({});
|
||||
}
|
||||
|
||||
void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
||||
Reference in New Issue
Block a user