about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-03-09 14:10:09 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-03-09 14:10:09 +0100
commit33846405d8e0af86bb5cfb9dab4ea5026fadb614 (patch)
tree7fb9153caa2103fd0ec096472c542bcf4a4c6aea /src/wrapped
parent378eb79ad3ec58b4c19b3b38845cdb8a5db8dc5d (diff)
downloadbox64-33846405d8e0af86bb5cfb9dab4ea5026fadb614.tar.gz
box64-33846405d8e0af86bb5cfb9dab4ea5026fadb614.zip
Improved unload of libs (help wine when dlopen / dlclose is supposed to unload the lib so it can be dlopen again)
Diffstat (limited to 'src/wrapped')
-rw-r--r--src/wrapped/wrappedlibc.c3
-rw-r--r--src/wrapped/wrappedlibdl.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 0100385c..6ff9bab7 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -3440,7 +3440,8 @@ static void* timed_exit_thread(void* a)
 {
     // this is a workaround for some NVidia drivers on ARM64 that may freeze at exit
     // waiting on a pthread_cond_destroy
-    usleep(500000); // wait 1/2 a second
+    usleep(5000000); // wait 5 seconds
+    printf_log(LOG_DEBUG, "Too late, forced exit...\n");
     _exit(box64_exit_code); // force exit, something is wrong
 }
 
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c
index 98d81034..c0f653b6 100644
--- a/src/wrapped/wrappedlibdl.c
+++ b/src/wrapped/wrappedlibdl.c
@@ -412,7 +412,7 @@ int my_dlclose(x64emu_t* emu, void *handle)
     }
     --dl->dllibs[nlib].count;
     elfheader_t* h = GetElf(dl->dllibs[nlib].lib);
-    if(!h || !h->gnuunique || actualy_closing)
+    if((h && !h->gnuunique) || !h || actualy_closing)
         DecRefCount(&dl->dllibs[nlib].lib, emu);
     return 0;
 }