Fix WindowCursor memory leak.

ObjectReader release method was replaced by close method but
WindowCursor was still implementing release method.

To prevent the same mistake again, make ObjectReader close method
abstract to force sub classes to implement it.

Change-Id: I50d0d1d19a26e306fd0dba77b246a95a44fd6584
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
This commit is contained in:
Hugo Arès 2015-05-28 14:21:03 -04:00
parent ebfd62433a
commit 27128b3e01
6 changed files with 7 additions and 8 deletions

View File

@ -123,7 +123,7 @@ public void setUp() throws Exception {
@After
public void tearDown() throws Exception {
if (wc != null)
wc.release();
wc.close();
new WindowCacheConfig().install();
super.tearDown();
}

View File

@ -108,7 +108,7 @@ public void setUp() throws Exception {
@After
public void tearDown() throws Exception {
if (wc != null)
wc.release();
wc.close();
new WindowCacheConfig().install();
super.tearDown();
}

View File

@ -80,6 +80,6 @@ public int read() throws IOException {
@Override
public void close() {
wc.release();
wc.close();
}
}

View File

@ -95,7 +95,7 @@ public static ObjectLoader parse(byte[] raw, AnyObjectId id)
try {
return open(new ByteArrayInputStream(raw), null, id, wc);
} finally {
wc.release();
wc.close();
}
}

View File

@ -330,7 +330,8 @@ int getStreamFileThreshold() {
}
/** Release the current window cursor. */
public void release() {
@Override
public void close() {
window = null;
baseCache = null;
try {

View File

@ -430,7 +430,5 @@ public BitmapIndex getBitmapIndex() throws IOException {
* @since 4.0
*/
@Override
public void close() {
// Do nothing.
}
public abstract void close();
}