summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r--Libraries/LibWeb/DOM/Timer.cpp1
-rw-r--r--Libraries/LibWeb/DOM/Window.cpp5
-rw-r--r--Libraries/LibWeb/DOM/Window.h1
3 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibWeb/DOM/Timer.cpp b/Libraries/LibWeb/DOM/Timer.cpp
index a9bf2dcd4b..04e3c778f5 100644
--- a/Libraries/LibWeb/DOM/Timer.cpp
+++ b/Libraries/LibWeb/DOM/Timer.cpp
@@ -54,6 +54,7 @@ Timer::Timer(Window& window, Type type, int milliseconds, JS::Function& callback
Timer::~Timer()
{
+ m_window.deallocate_timer_id({}, m_id);
}
}
diff --git a/Libraries/LibWeb/DOM/Window.cpp b/Libraries/LibWeb/DOM/Window.cpp
index e651a524ee..615d0ca679 100644
--- a/Libraries/LibWeb/DOM/Window.cpp
+++ b/Libraries/LibWeb/DOM/Window.cpp
@@ -108,6 +108,11 @@ i32 Window::allocate_timer_id(Badge<Timer>)
return m_timer_id_allocator.allocate();
}
+void Window::deallocate_timer_id(Badge<Timer>, i32 id)
+{
+ m_timer_id_allocator.deallocate(id);
+}
+
void Window::clear_timeout(i32 timer_id)
{
m_timers.remove(timer_id);
diff --git a/Libraries/LibWeb/DOM/Window.h b/Libraries/LibWeb/DOM/Window.h
index 3602b1d5c8..7de6cbacf5 100644
--- a/Libraries/LibWeb/DOM/Window.h
+++ b/Libraries/LibWeb/DOM/Window.h
@@ -74,6 +74,7 @@ public:
void set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&);
i32 allocate_timer_id(Badge<Timer>);
+ void deallocate_timer_id(Badge<Timer>, i32);
void timer_did_fire(Badge<Timer>, Timer&);
HighResolutionTime::Performance& performance() { return *m_performance; }