Skip to content
Permalink
Browse files
copy the old eventHooks list when adding a new eventHook
fixes #2296

Sponsored by Lookout Inc.
  • Loading branch information
mkristian committed Dec 11, 2014
1 parent ff3d32c commit 2746b568707ab6f5149bb66892b7d4eb026e48a1
Showing with 4 additions and 1 deletion.
  1. +4 −1 core/src/main/java/org/jruby/Ruby.java
@@ -44,6 +44,7 @@
import jnr.constants.platform.Errno;
import jnr.posix.POSIX;
import jnr.posix.POSIXFactory;

import org.jcodings.Encoding;
import org.joda.time.DateTimeZone;
import org.jruby.RubyInstanceConfig.CompileMode;
@@ -156,6 +157,7 @@
import java.security.AccessControlException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
@@ -180,6 +182,7 @@
import java.util.regex.Pattern;

import static org.jruby.internal.runtime.GlobalVariable.Scope.*;

import org.jruby.internal.runtime.methods.CallConfiguration;
import org.jruby.internal.runtime.methods.JavaMethod;
import org.jruby.util.cli.Options;
@@ -3025,7 +3028,7 @@ public synchronized void addEventHook(EventHook hook) {
}

EventHook[] hooks = eventHooks;
EventHook[] newHooks = new EventHook[hooks.length + 1];
EventHook[] newHooks = Arrays.copyOf(hooks, hooks.length + 1);
newHooks[hooks.length] = hook;
eventHooks = newHooks;
hasEventHooks = true;

0 comments on commit 2746b56

Please sign in to comment.