Browse Source

fixed a VST crash caused by closing Nuendo with a window open; updated win32 memory detection calls

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
5cbd3c2f4c
3 changed files with 18 additions and 35 deletions
  1. +3
    -1
      extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm
  2. +1
    -1
      extras/juce demo/src/demos/FontsAndTextDemo.cpp
  3. +14
    -33
      src/native/windows/juce_win32_SystemStats.cpp

+ 3
- 1
extras/audio plugins/wrapper/VST/juce_VST_Wrapper.mm View File

@@ -191,7 +191,9 @@ void detachComponentFromWindowRef (Component* comp, void* nsWindow)
HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int)
comp->getComponentProperty ("dummyViewRef", false, String::empty).getHexValue64(); comp->getComponentProperty ("dummyViewRef", false, String::empty).getHexValue64();
CFRelease (dummyView);
if (HIViewIsValid (dummyView))
CFRelease (dummyView);
NSWindow* hostWindow = (NSWindow*) nsWindow; NSWindow* hostWindow = (NSWindow*) nsWindow;
NSView* pluginView = (NSView*) comp->getWindowHandle(); NSView* pluginView = (NSView*) comp->getWindowHandle();


+ 1
- 1
extras/juce demo/src/demos/FontsAndTextDemo.cpp View File

@@ -63,7 +63,7 @@ public:
textBox->setMultiLine (true, true); textBox->setMultiLine (true, true);
textBox->setReturnKeyStartsNewLine (true); textBox->setReturnKeyStartsNewLine (true);
textBox->setText (T("The Quick Brown Fox Jumped Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789"));
textBox->setText (T("The Quick Brown Fox Jumps Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789"));
addAndMakeVisible (boldButton = new ToggleButton (T("bold"))); addAndMakeVisible (boldButton = new ToggleButton (T("bold")));
boldButton->addButtonListener (this); boldButton->addButtonListener (this);


+ 14
- 33
src/native/windows/juce_win32_SystemStats.cpp View File

@@ -254,21 +254,14 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
{ {
switch (info.dwMajorVersion) switch (info.dwMajorVersion)
{ {
case 5:
return (info.dwMinorVersion == 0) ? Win2000 : WinXP;
case 6:
return (info.dwMinorVersion == 0) ? WinVista : Windows7;
default:
jassertfalse // !! not a supported OS!
break;
case 5: return (info.dwMinorVersion == 0) ? Win2000 : WinXP;
case 6: return (info.dwMinorVersion == 0) ? WinVista : Windows7;
default: jassertfalse; break; // !! not a supported OS!
} }
} }
else if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) else if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{ {
jassert (info.dwMinorVersion != 0); // !! still running on Windows 95?? jassert (info.dwMinorVersion != 0); // !! still running on Windows 95??
return Win98; return Win98;
} }
@@ -281,25 +274,12 @@ const String SystemStats::getOperatingSystemName() throw()
switch (getOperatingSystemType()) switch (getOperatingSystemType())
{ {
case WinVista:
name = "Windows Vista";
break;
case WinXP:
name = "Windows XP";
break;
case Win2000:
name = "Windows 2000";
break;
case Win98:
name = "Windows 98";
break;
default:
jassertfalse // !! new type of OS?
break;
case Windows7: name = "Windows 7"; break;
case WinVista: name = "Windows Vista"; break;
case WinXP: name = "Windows XP"; break;
case Win2000: name = "Windows 2000"; break;
case Win98: name = "Windows 98"; break;
default: jassertfalse; break; // !! new type of OS?
} }
return name; return name;
@@ -310,7 +290,7 @@ bool SystemStats::isOperatingSystem64Bit() throw()
#ifdef _WIN64 #ifdef _WIN64
return true; return true;
#else #else
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process"); LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
@@ -326,9 +306,10 @@ bool SystemStats::isOperatingSystem64Bit() throw()
//============================================================================== //==============================================================================
int SystemStats::getMemorySizeInMegabytes() throw() int SystemStats::getMemorySizeInMegabytes() throw()
{ {
MEMORYSTATUS mem;
GlobalMemoryStatus (&mem);
return (int) (mem.dwTotalPhys / (1024 * 1024)) + 1;
MEMORYSTATUSEX mem;
mem.dwLength = sizeof (mem);
GlobalMemoryStatusEx (&mem);
return (int) (mem.ullTotalPhys / (1024 * 1024)) + 1;
} }
int SystemStats::getNumCpus() throw() int SystemStats::getNumCpus() throw()


Loading…
Cancel
Save