Fix thinko in java::lang::Class::finalize

Andrew Haley aph@redhat.com
Tue Jul 12 12:50:00 GMT 2011


This one is pretty obvious.  We never noticed it before because
finalizers are run in a try block that catches all exceptions,
including the NullPointerException this always throws.

Andrew.


2011-07-12  Andrew Haley  <aph@redhat.com>

	* java/lang/natClass.cc (finalize): Make sure that the class
	really has an engine.

Index: java/lang/natClass.cc
===================================================================
--- java/lang/natClass.cc       (revision 176198)
+++ java/lang/natClass.cc       (working copy)
@@ -668,7 +668,9 @@
 void
 java::lang::Class::finalize (void)
 {
-  engine->unregister(this);
+  // Array classes don't have an engine, and don't need to be finalized.
+   if (engine)
+     engine->unregister(this);
 }

 #ifdef INTERPRETER



More information about the Java-patches mailing list