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:
parent
ebfd62433a
commit
27128b3e01
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,6 @@ public int read() throws IOException {
|
|||
|
||||
@Override
|
||||
public void close() {
|
||||
wc.release();
|
||||
wc.close();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -330,7 +330,8 @@ int getStreamFileThreshold() {
|
|||
}
|
||||
|
||||
/** Release the current window cursor. */
|
||||
public void release() {
|
||||
@Override
|
||||
public void close() {
|
||||
window = null;
|
||||
baseCache = null;
|
||||
try {
|
||||
|
|
|
@ -430,7 +430,5 @@ public BitmapIndex getBitmapIndex() throws IOException {
|
|||
* @since 4.0
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
// Do nothing.
|
||||
}
|
||||
public abstract void close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue