Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 25490 invoked from network); 17 Sep 2010 06:39:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Sep 2010 06:39:40 -0000 Received: (qmail 47318 invoked by uid 500); 17 Sep 2010 06:39:40 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 47205 invoked by uid 500); 17 Sep 2010 06:39:37 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 47198 invoked by uid 99); 17 Sep 2010 06:39:36 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 06:39:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 06:39:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4686A23889D5; Fri, 17 Sep 2010 06:38:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r997994 - /harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp Date: Fri, 17 Sep 2010 06:38:58 -0000 To: commits@harmony.apache.org From: regisxu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100917063858.4686A23889D5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: regisxu Date: Fri Sep 17 06:38:57 2010 New Revision: 997994 URL: http://svn.apache.org/viewvc?rev=997994&view=rev Log: 'obj' is still useful, delete local reference at more safe place. Modified: harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp Modified: harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp?rev=997994&r1=997993&r2=997994&view=diff ============================================================================== --- harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp (original) +++ harmony/enhanced/java/branches/java6/jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp Fri Sep 17 06:38:57 2010 @@ -313,10 +313,11 @@ jclass InputPacketParser::ReadReferenceT } jclass cls = 0; + jobject obj = 0; if(rtid < REFTYPEID_MINIMUM) { // For a ObjectID, we should convert it to ReferenceTypeID // if it is a ClassObjectID - jobject obj = GetObjectManager().MapFromObjectID(jni, rtid); + obj = GetObjectManager().MapFromObjectID(jni, rtid); if (NULL == obj) { JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "MapFromObjectID returned NULL")); AgentException ex(JDWP_ERROR_INVALID_OBJECT); @@ -336,10 +337,10 @@ jclass InputPacketParser::ReadReferenceT if (isClass) { JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "## ReadReferenceTypeIDOrNul: read : ObjectID is a ClassObjectID")); cls = static_cast (obj); - jni->DeleteLocalRef(obj); - jboolean isValidID = GetObjectManager().FindObjectID(jni, cls, rtid); + jboolean isValidID = GetObjectManager().FindObjectID(jni, cls, rtid); if(!isValidID) { + jni->DeleteLocalRef(obj); JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## ReadReferenceTypeIDOrNul: read : ID is an invalid ObjectID")); AgentException ex(JDWP_ERROR_INVALID_OBJECT); JDWP_SET_EXCEPTION(ex); @@ -369,6 +370,9 @@ jclass InputPacketParser::ReadReferenceT // make GlobalReference and check if WeakReference was freed jclass ref = static_cast(jni->NewGlobalRef(cls)); + if (obj != 0) { + jni->DeleteLocalRef(obj); + } if (ref == 0) { if (jni->IsSameObject(cls, 0)) { JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Invalid object calling NewGlobalRef"));