public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix thinko in java::lang::Class::finalize
@ 2011-07-12 12:50 Andrew Haley
  0 siblings, 0 replies; only message in thread
From: Andrew Haley @ 2011-07-12 12:50 UTC (permalink / raw)
  To: GCJ-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-12 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 12:50 Fix thinko in java::lang::Class::finalize Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).