android: No need to have the loolwsd instance static.

When we don't treat it as static anyway...

Change-Id: I165c06390882cfb9870c338a361ec3c5216985c7
This commit is contained in:
Jan Holesovsky 2019-06-14 15:14:34 +02:00
parent a742f95473
commit 9ea4f537d4

View file

@ -30,7 +30,6 @@ const int SHOW_JS_MAXLEN = 70;
int loolwsd_server_socket_fd = -1;
static std::string fileURL;
static LOOLWSD *loolwsd = nullptr;
static int fakeClientFd;
static int closeNotificationPipeForForwardingThread[2];
static JavaVM* javaVM = nullptr;
@ -267,7 +266,6 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
std::thread([]
{
assert(loolwsd == nullptr);
char *argv[2];
argv[0] = strdup("mobile");
argv[1] = nullptr;
@ -275,9 +273,10 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
while (true)
{
LOG_DBG("Creating LOOLWSD");
loolwsd = new LOOLWSD();
loolwsd->run(1, argv);
delete loolwsd;
{
std::unique_ptr<LOOLWSD> loolwsd(new LOOLWSD());
loolwsd->run(1, argv);
}
LOG_DBG("One run of LOOLWSD completed");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}