From e8b836dec8b223f8b0523f38151b8fb96de43c25 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 26 Mar 2019 00:55:29 +0000 Subject: [PATCH] Ensure that TimedEventExecutor timings are closed (Fixes #1918) pre this, any event handler firing an exception would leave the timings open, causing the timings stack to be corrupted --- Spigot-API-Patches/Timings-v2.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Spigot-API-Patches/Timings-v2.patch b/Spigot-API-Patches/Timings-v2.patch index 36cc56d89e..87d12345cb 100644 --- a/Spigot-API-Patches/Timings-v2.patch +++ b/Spigot-API-Patches/Timings-v2.patch @@ -169,7 +169,7 @@ index 000000000..8e0cd40e8 +} diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java new file mode 100644 -index 000000000..68f7866e1 +index 000000000..933ecf9bd --- /dev/null +++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java @@ -0,0 +0,0 @@ @@ -251,9 +251,9 @@ index 000000000..68f7866e1 + executor.execute(listener, event); + return; + } -+ timings.startTiming(); -+ executor.execute(listener, event); -+ timings.stopTiming(); ++ try (Timing ignored = timings.startTiming()){ ++ executor.execute(listener, event); ++ } + } +} diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java