From 8062421eab399c5d9bfadf5ca4326a8090536aee Mon Sep 17 00:00:00 2001 From: nhkode Date: Fri, 10 Jan 2025 11:22:18 +0100 Subject: [PATCH] fix crashes with Recompile shader on file change Without the timeout select seems to hang indefinitely. Without the rfds initialization select never reported any changes. --- src/SHADERed/UI/CodeEditorUI.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SHADERed/UI/CodeEditorUI.cpp b/src/SHADERed/UI/CodeEditorUI.cpp index 59c6ac83..c7e72dd7 100644 --- a/src/SHADERed/UI/CodeEditorUI.cpp +++ b/src/SHADERed/UI/CodeEditorUI.cpp @@ -1851,7 +1851,13 @@ namespace ed { } #elif defined(__linux__) || defined(__unix__) fd_set rfds; - int eCount = select(notifyEngine + 1, &rfds, NULL, NULL, NULL); + FD_ZERO(&rfds); + FD_SET(notifyEngine, &rfds); + timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 100000; + + int eCount = select(notifyEngine + 1, &rfds, NULL, NULL, &timeout); if (eCount <= 0) continue;