public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: GCJ-patches <java-patches@gcc.gnu.org>
Subject: Fix thinko in java::lang::Class::finalize
Date: Tue, 12 Jul 2011 12:50:00 -0000	[thread overview]
Message-ID: <4E1C42E5.10107@redhat.com> (raw)

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

                 reply	other threads:[~2011-07-12 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E1C42E5.10107@redhat.com \
    --to=aph@redhat.com \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).