Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A431417203 for ; Thu, 29 Jan 2015 15:16:39 +0000 (UTC) Received: (qmail 38862 invoked by uid 500); 29 Jan 2015 15:16:40 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 38814 invoked by uid 500); 29 Jan 2015 15:16:40 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 38805 invoked by uid 99); 29 Jan 2015 15:16:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jan 2015 15:16:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1AC7AE04BF; Thu, 29 Jan 2015 15:16:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tabish@apache.org To: commits@activemq.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: activemq-cpp git commit: Apply patch from: https://issues.apache.org/jira/browse/AMQCPP-562 Date: Thu, 29 Jan 2015 15:16:40 +0000 (UTC) Repository: activemq-cpp Updated Branches: refs/heads/trunk 22c35e717 -> 78669b739 Apply patch from: https://issues.apache.org/jira/browse/AMQCPP-562 Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/78669b73 Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/78669b73 Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/78669b73 Branch: refs/heads/trunk Commit: 78669b739103386e6c89cd63faef898e375452fa Parents: 22c35e7 Author: Timothy Bish Authored: Thu Jan 29 10:08:22 2015 -0500 Committer: Timothy Bish Committed: Thu Jan 29 10:08:22 2015 -0500 ---------------------------------------------------------------------- activemq-cpp/src/main/decaf/util/ArrayList.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/78669b73/activemq-cpp/src/main/decaf/util/ArrayList.h ---------------------------------------------------------------------- diff --git a/activemq-cpp/src/main/decaf/util/ArrayList.h b/activemq-cpp/src/main/decaf/util/ArrayList.h index c3a1878..d833d95 100644 --- a/activemq-cpp/src/main/decaf/util/ArrayList.h +++ b/activemq-cpp/src/main/decaf/util/ArrayList.h @@ -170,11 +170,15 @@ namespace util { public: virtual void clear() { - delete [] this->elements; - this->curSize = 0; - this->capacity = 10; - this->elements = new E[this->capacity]; - AbstractList::modCount++; + if (this->curSize > 0) { + delete [] this->elements; + this->curSize = 0; + this->capacity = 10; + this->elements = new E[this->capacity]; + AbstractList::modCount++; + } else { + ensureCapacity(10); + } } virtual bool isEmpty() const {