Skip to content

Commit

Permalink
wine related fixes
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Mar 7, 2024
1 parent 4f94d61 commit 2e43dda
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 7 additions & 0 deletions source/bridges-plugin/CarlaBridgePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ static void saveSignalHandler(int) noexcept
gSaveNow = true;
}
#elif defined(CARLA_OS_WIN)
static LONG WINAPI winExceptionFilter(_EXCEPTION_POINTERS*)
{
return EXCEPTION_EXECUTE_HANDLER;
}

static BOOL WINAPI winSignalHandler(DWORD dwCtrlType) noexcept
{
if (dwCtrlType == CTRL_C_EVENT)
Expand Down Expand Up @@ -115,6 +120,8 @@ static void initSignalHandler()
sigaction(SIGUSR1, &sig, nullptr);
#elif defined(CARLA_OS_WIN)
SetConsoleCtrlHandler(winSignalHandler, TRUE);
SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetUnhandledExceptionFilter(winExceptionFilter);
#endif
}

Expand Down
17 changes: 16 additions & 1 deletion source/discovery/carla-discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class DiscoveryPipe : public CarlaPipeClient

CarlaScopedPointer<DiscoveryPipe> gPipe;


// --------------------------------------------------------------------------------------------------------------------
// Don't print ELF/EXE related errors since discovery can find multi-architecture binaries

Expand All @@ -151,6 +150,16 @@ static void print_lib_error(const char* const filename)
}
}

#ifdef CARLA_OS_WIN
// --------------------------------------------------------------------------------------------------------------------
// Do not show error message box on Windows

static LONG WINAPI winExceptionFilter(_EXCEPTION_POINTERS*)
{
return EXCEPTION_EXECUTE_HANDLER;
}
#endif

// --------------------------------------------------------------------------------------------------------------------
// Plugin Checks

Expand Down Expand Up @@ -2305,13 +2314,19 @@ int main(int argc, const char* argv[])
#endif

#ifdef CARLA_OS_WIN
// init win32 stuff that plugins might use
OleInitialize(nullptr);
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

# ifndef __WINPTHREADS_VERSION
// (non-portable) initialization of statically linked pthread library
pthread_win32_process_attach_np();
pthread_win32_thread_attach_np();
# endif

// do not show error message box on Windows
SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetUnhandledExceptionFilter(winExceptionFilter);
#endif

// ---------------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion source/native-plugins/external
Submodule external updated 1 files
+1 −1 Makefile.mk

0 comments on commit 2e43dda

Please sign in to comment.