File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
app/src/main/java/org/kiwix/kiwixmobile/webserver Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,13 @@ import javax.inject.Inject
2828
2929private const val TAG = " KiwixServer"
3030
31- class KiwixServer @Inject constructor(private val jniKiwixServer : Server ) {
31+ // jniKiwixServer is a server running on a existing library.
32+ // We must keep the library alive (keep a reference to it) to not delete the library the server
33+ // is working on.
34+ class KiwixServer @Inject constructor(
35+ private val library : Library ,
36+ private val jniKiwixServer : Server
37+ ) {
3238
3339 class Factory @Inject constructor() {
3440 fun createKiwixServer (selectedBooksPath : ArrayList <String >): KiwixServer {
@@ -43,7 +49,7 @@ class KiwixServer @Inject constructor(private val jniKiwixServer: Server) {
4349 Log .v(TAG , " Couldn't add book with path:{ $path }" )
4450 }
4551 }
46- return KiwixServer (Server (kiwixLibrary))
52+ return KiwixServer (kiwixLibrary, Server (kiwixLibrary))
4753 }
4854 }
4955
You can’t perform that action at this time.
0 commit comments