diff --git a/build/linux/platform_specific_code/juce_linux_Messaging.cpp b/build/linux/platform_specific_code/juce_linux_Messaging.cpp index 2abe239a07..1215def31f 100644 --- a/build/linux/platform_specific_code/juce_linux_Messaging.cpp +++ b/build/linux/platform_specific_code/juce_linux_Messaging.cpp @@ -79,6 +79,8 @@ struct MessageThreadFuncCall }; static bool errorCondition = false; +static XErrorHandler oldErrorHandler = (XErrorHandler) 0; +static XIOErrorHandler oldIOErrorHandler = (XIOErrorHandler) 0; // (defined in another file to avoid problems including certain headers in this one) extern bool juce_isRunningAsApplication(); @@ -90,7 +92,7 @@ static int ioErrorHandler (Display* display) errorCondition = true; - if (! juce_isRunningAsApplication()) + if (juce_isRunningAsApplication()) Process::terminate(); return 0; @@ -151,25 +153,33 @@ static void sig_handler (int sig) } } - //============================================================================== void MessageManager::doPlatformSpecificInitialisation() { // Initialise xlib for multiple thread support - if (! XInitThreads()) + static bool initThreadCalled = false; + + if (! initThreadCalled) { - // This is fatal! Print error and closedown - Logger::outputDebugString ("Failed to initialise xlib thread support."); + if (! XInitThreads()) + { + // This is fatal! Print error and closedown + Logger::outputDebugString ("Failed to initialise xlib thread support."); - if (juce_isRunningAsApplication()) - Process::terminate(); + if (juce_isRunningAsApplication()) + Process::terminate(); + + return; + } + + initThreadCalled = true; } // This is called if the client/server connection is broken - XSetIOErrorHandler (ioErrorHandler); + oldIOErrorHandler = XSetIOErrorHandler (ioErrorHandler); // This is called if a protocol error occurs - XSetErrorHandler (errorHandler); + oldErrorHandler = XSetErrorHandler (errorHandler); // Install signal handler for break-in struct sigaction saction; @@ -202,6 +212,8 @@ void MessageManager::doPlatformSpecificInitialisation() if (juce_isRunningAsApplication()) Process::terminate(); + + return; } // Get defaults for various properties @@ -235,6 +247,16 @@ void MessageManager::doPlatformSpecificShutdown() { XDestroyWindow (display, juce_messageWindowHandle); XCloseDisplay (display); + + // reset pointers + juce_messageWindowHandle = 0; + display = 0; + + // Restore original error handlers + XSetIOErrorHandler (oldIOErrorHandler); + oldIOErrorHandler = 0; + XSetErrorHandler (oldErrorHandler); + oldErrorHandler = 0; } } @@ -328,6 +350,8 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) if (juce_isRunningAsApplication()) Process::terminate(); + + return false; } if (returnIfNoPendingMessages && ! XPending (display)) diff --git a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp index 33eeabf01d..2cf4a874d8 100644 --- a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp +++ b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp @@ -188,7 +188,12 @@ bool juce_IsRunningInWine() throw() //============================================================================== const String JUCE_CALLTYPE PlatformUtilities::getCurrentCommandLineParams() throw() { - return String (::GetCommandLineW()); + String s (::GetCommandLineW()); + + StringArray tokens; + tokens.addTokens (s, true); // tokenise so that we can remove the initial filename argument + + return tokens.joinIntoString (T(" "), 1); } //============================================================================== diff --git a/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.cpp b/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.cpp index 674b535034..6bc39fb742 100644 --- a/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.cpp +++ b/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.cpp @@ -43,8 +43,8 @@ Image* juce_createIconForFile (const File& file); //============================================================================== FileListComponent::FileListComponent (DirectoryContentsList& listToShow) - : DirectoryContentsDisplayComponent (listToShow), - ListBox (String::empty, 0) + : ListBox (String::empty, 0), + DirectoryContentsDisplayComponent (listToShow) { setModel (this); fileList.addChangeListener (this); diff --git a/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.h b/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.h index 4216671083..03429cac72 100644 --- a/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.h +++ b/src/juce_appframework/gui/components/filebrowser/juce_FileListComponent.h @@ -50,8 +50,8 @@ @see DirectoryContentsList, FileTreeComponent */ -class JUCE_API FileListComponent : public DirectoryContentsDisplayComponent, - public ListBox, +class JUCE_API FileListComponent : public ListBox, + public DirectoryContentsDisplayComponent, private ListBoxModel, private ChangeListener { diff --git a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h index 7abca4b5f5..b4255d28c8 100644 --- a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h +++ b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h @@ -48,8 +48,8 @@ @see DirectoryContentsList, FileListComponent */ -class JUCE_API FileTreeComponent : public DirectoryContentsDisplayComponent, - public TreeView +class JUCE_API FileTreeComponent : public TreeView, + public DirectoryContentsDisplayComponent { public: //============================================================================== diff --git a/src/juce_core/basics/juce_Time.cpp b/src/juce_core/basics/juce_Time.cpp index 17a5e45f7c..77814e282a 100644 --- a/src/juce_core/basics/juce_Time.cpp +++ b/src/juce_core/basics/juce_Time.cpp @@ -134,14 +134,16 @@ Time::Time (const int year, const int hours, const int minutes, const int seconds, - const int milliseconds) throw() + const int milliseconds, + const bool useLocalTime) throw() { jassert (year > 100); // year must be a 4-digit version - if (year < 1971 || year >= 2038) + if (year < 1971 || year >= 2038 || ! useLocalTime) { // use extended maths for dates beyond 1970 to 2037.. - const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); + const int timeZoneAdjustment = useLocalTime ? (31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000)) + : 0; const int a = (13 - month) / 12; const int y = year + 4800 - a; const int jd = day + (153 * (month + 12 * a - 2) + 2) / 5 diff --git a/src/juce_core/basics/juce_Time.h b/src/juce_core/basics/juce_Time.h index e6d8fa2c3b..cbcaf70016 100644 --- a/src/juce_core/basics/juce_Time.h +++ b/src/juce_core/basics/juce_Time.h @@ -83,6 +83,8 @@ public: @param minutes minutes 0 to 59 @param seconds seconds 0 to 59 @param milliseconds milliseconds 0 to 999 + @param useLocalTime if true, encode using the current machine's local time; if + false, it will always work in GMT. */ Time (const int year, const int month, @@ -90,7 +92,8 @@ public: const int hours, const int minutes, const int seconds = 0, - const int milliseconds = 0) throw(); + const int milliseconds = 0, + const bool useLocalTime = true) throw(); /** Destructor. */ ~Time() throw(); diff --git a/src/juce_core/misc/juce_ZipFile.cpp b/src/juce_core/misc/juce_ZipFile.cpp index 7f3b212665..3b18302781 100644 --- a/src/juce_core/misc/juce_ZipFile.cpp +++ b/src/juce_core/misc/juce_ZipFile.cpp @@ -93,7 +93,7 @@ public: ~ZipInputStream() throw() { -#ifdef JUCE_DEBUG +#ifdef JUCE_DEBUG if (inputStream != 0 && inputStream == file.inputStream) file.numOpenStreams--; #endif