Procházet zdrojové kódy

libobs/util: Prevent locking mutex in child process when checking Qt5

The frontend has set a log handler which locks the mutex in `LogString`.
If `os_dlopen` fails in the child process, it calls `blog` and attempted
to lock the mutex that may have already been locked by another thread
before `fork()`. This change prevents the child process from locking the
mutex, resolving the potential deadlock.
Norihiro Kamae před 6 měsíci
rodič
revize
5c448452cf
1 změnil soubory, kde provedl 1 přidání a 0 odebrání
  1. 1 0
      libobs/util/platform-nix.c

+ 1 - 0
libobs/util/platform-nix.c

@@ -134,6 +134,7 @@ bool has_qt5_dependency(const char *path)
 {
 {
 	pid_t pid = fork();
 	pid_t pid = fork();
 	if (pid == 0) {
 	if (pid == 0) {
+		base_set_log_handler(NULL, NULL);
 		_exit(module_has_qt5_check(path));
 		_exit(module_has_qt5_check(path));
 	}
 	}
 	if (pid < 0) {
 	if (pid < 0) {