From f29aa4c468253dd8660b6ba2364df541a119eed1 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 6 Dec 2011 20:17:57 +0000 Subject: [PATCH] Changed the OSX folder used for interprocess lock files. Fixed the JUCE_CATCH_UNHANDLED_EXCEPTIONS flag. --- modules/juce_core/juce_core.h | 7 +++++++ modules/juce_core/native/juce_posix_SharedCode.h | 13 +++++++++---- modules/juce_core/system/juce_PlatformDefs.h | 2 +- modules/juce_events/juce_events.cpp | 4 ++++ .../juce_events/native/juce_mac_MessageManager.mm | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/juce_core/juce_core.h b/modules/juce_core/juce_core.h index 17c4663416..f170780cb9 100644 --- a/modules/juce_core/juce_core.h +++ b/modules/juce_core/juce_core.h @@ -90,6 +90,13 @@ #define JUCE_ZLIB_INCLUDE_PATH #endif +/* Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS + If enabled, this will add some exception-catching code to forward unhandled exceptions + to your JUCEApplication::unhandledException() callback. +*/ +#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS + //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1 +#endif //============================================================================= //============================================================================= diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 51f58b14e0..bce9c5452f 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -682,11 +682,16 @@ public: #if JUCE_IOS handle = 1; // On iOS we can't run multiple apps, so just assume success. #else - // Note that we can't get the normal temp folder here, as it might be different for each app. - File tempFolder ("/var/tmp"); - if (! tempFolder.isDirectory()) - tempFolder = "/tmp"; + // Note that we can't get the normal temp folder here, as it might be different for each app. + #if JUCE_MAC + File tempFolder ("~/Library/Caches/com.juce.locks"); + #else + File tempFolder ("/var/tmp"); + + if (! tempFolder.isDirectory()) + tempFolder = "/tmp"; + #endif const File temp (tempFolder.getChildFile (name)); diff --git a/modules/juce_core/system/juce_PlatformDefs.h b/modules/juce_core/system/juce_PlatformDefs.h index 37600dca33..285cea9fb4 100644 --- a/modules/juce_core/system/juce_PlatformDefs.h +++ b/modules/juce_core/system/juce_PlatformDefs.h @@ -205,7 +205,7 @@ #define JUCE_CATCH_ALL catch (...) {} #define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse; } - #if JUCE_ONLY_BUILD_CORE_LIBRARY + #if ! JUCE_MODULE_AVAILABLE_juce_gui_basics #define JUCE_CATCH_EXCEPTION JUCE_CATCH_ALL #else /** Used in try-catch blocks, this macro will send exceptions to the JUCEApplication diff --git a/modules/juce_events/juce_events.cpp b/modules/juce_events/juce_events.cpp index 528b26b804..69f2e67e80 100644 --- a/modules/juce_events/juce_events.cpp +++ b/modules/juce_events/juce_events.cpp @@ -39,6 +39,10 @@ #include "../juce_core/native/juce_BasicNativeHeaders.h" #include "juce_events.h" +#if JUCE_CATCH_UNHANDLED_EXCEPTIONS && JUCE_MODULE_AVAILABLE_juce_gui_basics + #include "../juce_gui_basics/juce_gui_basics.h" +#endif + //============================================================================== #if JUCE_MAC #import diff --git a/modules/juce_events/native/juce_mac_MessageManager.mm b/modules/juce_events/native/juce_mac_MessageManager.mm index ec24ad1e13..6b0b88e531 100644 --- a/modules/juce_events/native/juce_mac_MessageManager.mm +++ b/modules/juce_events/native/juce_mac_MessageManager.mm @@ -310,7 +310,7 @@ void MessageManager::runDispatchLoop() { // An AppKit exception will kill the app, but at least this provides a chance to log it., std::runtime_error ex (std::string ("NSException: ") + [[e name] UTF8String] + ", Reason:" + [[e reason] UTF8String]); - JUCEApplicationBase::sendUnhandledException (&ex, __FILE__, __LINE__); + JUCEApplication::sendUnhandledException (&ex, __FILE__, __LINE__); } @finally {