mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-12 08:44:10 -04:00
All java class wrapping a native object must call dispose at destruction.
This commit is contained in:
parent
1dd170bd59
commit
150af85a7a
@ -45,6 +45,10 @@ public class Server
|
||||
setNativeServer(library);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
private native void setNativeServer(Library library);
|
||||
private native void dispose();
|
||||
private long nativeHandle;
|
||||
|
@ -104,6 +104,9 @@ public class Archive
|
||||
private native void setNativeArchiveByFD(FileDescriptor fd);
|
||||
private native void setNativeArchiveEmbedded(FileDescriptor fd, long offset, long size);
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
|
@ -26,9 +26,10 @@ public class Blob
|
||||
public native String getData();
|
||||
public native long size();
|
||||
|
||||
protected void finalize() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
|
@ -31,9 +31,8 @@ public class Entry
|
||||
public native Item getRedirect();
|
||||
public native Entry getRedirectEntry();
|
||||
|
||||
protected void finalize() {
|
||||
dispose();
|
||||
}
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
|
@ -29,6 +29,10 @@ public class EntryIterator implements Iterator<Entry>
|
||||
public native boolean hasNext();
|
||||
public native Entry next();
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -30,9 +30,8 @@ public class Item
|
||||
public native Blob getData();
|
||||
public native long getSize();
|
||||
|
||||
protected void finalize() {
|
||||
dispose();
|
||||
}
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
|
@ -28,6 +28,10 @@ public class Query
|
||||
public native Query setQuery(String query);
|
||||
public native Query setGeorange(float latitude, float longitute, float distance);
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -26,6 +26,10 @@ public class Search
|
||||
public native SearchIterator getResults(int start, int maxResults);
|
||||
public native long getEstimatedMatches();
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -36,6 +36,10 @@ public class SearchIterator implements Iterator<Entry>
|
||||
public native boolean hasNext();
|
||||
public native Entry next();
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -51,6 +51,10 @@ public class Searcher
|
||||
private native void setNativeSearcher(Archive archive);
|
||||
private native void setNativeSearcherMulti(Archive[] archives);
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -26,9 +26,8 @@ public class SuggestionItem
|
||||
public native String getSnippet();
|
||||
public native boolean hasSnippet();
|
||||
|
||||
protected void finalize() {
|
||||
dispose();
|
||||
}
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
|
@ -27,6 +27,10 @@ public class SuggestionIterator implements Iterator<SuggestionItem>
|
||||
public native boolean hasNext();
|
||||
public native SuggestionItem next();
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -26,6 +26,10 @@ public class SuggestionSearch
|
||||
public native SuggestionIterator getResults(int start, int maxResults);
|
||||
public native long getEstimatedMatches();
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
@ -40,6 +40,10 @@ public class SuggestionSearcher
|
||||
|
||||
private native void setNativeSearcher(Archive archive);
|
||||
|
||||
|
||||
@Override
|
||||
protected void finalize() { dispose(); }
|
||||
|
||||
///--------- The wrapper thing
|
||||
// To delete our native wrapper
|
||||
public native void dispose();
|
||||
|
Loading…
x
Reference in New Issue
Block a user