mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Thread-local value fix for plugins on XP. Android startup tweaks. Minor component changes.
This commit is contained in:
parent
bdd778332d
commit
59669e8bec
9 changed files with 51 additions and 16 deletions
|
|
@ -258,6 +258,11 @@ public:
|
|||
|
||||
void initialise (JNIEnv* env)
|
||||
{
|
||||
// NB: the DLL can be left loaded by the JVM, so the same static
|
||||
// objects can end up being reused by subsequent runs of the app
|
||||
zeromem (threads, sizeof (threads));
|
||||
zeromem (envs, sizeof (envs));
|
||||
|
||||
env->GetJavaVM (&jvm);
|
||||
addEnv (env);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,11 +98,29 @@ jfieldID JNIClassBase::resolveStaticField (JNIEnv* env, const char* fieldName, c
|
|||
//==============================================================================
|
||||
ThreadLocalJNIEnvHolder threadLocalJNIEnvHolder;
|
||||
|
||||
#if JUCE_DEBUG
|
||||
static bool systemInitialised = false;
|
||||
#endif
|
||||
|
||||
JNIEnv* getEnv() noexcept
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
if (! systemInitialised)
|
||||
{
|
||||
DBG ("*** Call to getEnv() when system not initialised");
|
||||
jassertfalse;
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return threadLocalJNIEnvHolder.getOrAttach();
|
||||
}
|
||||
|
||||
extern "C" jint JNI_OnLoad (JavaVM*, void*)
|
||||
{
|
||||
return JNI_VERSION_1_2;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
AndroidSystem::AndroidSystem() : screenWidth (0), screenHeight (0)
|
||||
{
|
||||
|
|
@ -111,9 +129,14 @@ AndroidSystem::AndroidSystem() : screenWidth (0), screenHeight (0)
|
|||
void AndroidSystem::initialise (JNIEnv* env, jobject activity_,
|
||||
jstring appFile_, jstring appDataDir_)
|
||||
{
|
||||
screenWidth = screenHeight = 0;
|
||||
JNIClassBase::initialiseAllClasses (env);
|
||||
|
||||
threadLocalJNIEnvHolder.initialise (env);
|
||||
#if JUCE_DEBUG
|
||||
systemInitialised = true;
|
||||
#endif
|
||||
|
||||
activity = GlobalRef (activity_);
|
||||
appFile = juceString (env, appFile_);
|
||||
appDataDir = juceString (env, appDataDir_);
|
||||
|
|
@ -122,6 +145,11 @@ void AndroidSystem::initialise (JNIEnv* env, jobject activity_,
|
|||
void AndroidSystem::shutdown (JNIEnv* env)
|
||||
{
|
||||
activity.clear();
|
||||
|
||||
#if JUCE_DEBUG
|
||||
systemInitialised = false;
|
||||
#endif
|
||||
|
||||
JNIClassBase::releaseAllClasses (env);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@
|
|||
#ifndef __JUCE_THREADLOCALVALUE_JUCEHEADER__
|
||||
#define __JUCE_THREADLOCALVALUE_JUCEHEADER__
|
||||
|
||||
#if ! (JUCE_MSVC || (JUCE_MAC && defined (__clang__) && defined (MAC_OS_X_VERSION_10_7) \
|
||||
&& MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7))
|
||||
// (NB: on win32, native thread-locals aren't possible in a dynamically loaded DLL in XP).
|
||||
#if ! ((JUCE_MSVC && (defined (_WIN64) || ! defined (JucePlugin_PluginCode))) \
|
||||
|| (JUCE_MAC && defined (__clang__) && defined (MAC_OS_X_VERSION_10_7) \
|
||||
&& MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7))
|
||||
#define JUCE_NO_COMPILER_THREAD_LOCAL 1
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -25,16 +25,11 @@
|
|||
|
||||
ChangeBroadcaster::ChangeBroadcaster() noexcept
|
||||
{
|
||||
// are you trying to create this object before or after juce has been intialised??
|
||||
jassert (MessageManager::getInstanceWithoutCreating() != nullptr);
|
||||
|
||||
callback.owner = this;
|
||||
}
|
||||
|
||||
ChangeBroadcaster::~ChangeBroadcaster()
|
||||
{
|
||||
// all event-based objects must be deleted BEFORE juce is shut down!
|
||||
jassert (MessageManager::getInstanceWithoutCreating() != nullptr);
|
||||
}
|
||||
|
||||
void ChangeBroadcaster::addChangeListener (ChangeListener* const listener)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ public:
|
|||
mm->quitMessageReceived = true;
|
||||
}
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (QuitMessage);
|
||||
JUCE_DECLARE_NON_COPYABLE (QuitMessage);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -239,8 +238,7 @@ public:
|
|||
|
||||
WaitableEvent lockedEvent, releaseEvent;
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BlockingMessage);
|
||||
JUCE_DECLARE_NON_COPYABLE (BlockingMessage);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -750,7 +750,11 @@ private:
|
|||
|
||||
void Component::setCachedComponentImage (CachedComponentImage* newCachedImage)
|
||||
{
|
||||
cachedImage = newCachedImage;
|
||||
if (cachedImage != newCachedImage)
|
||||
{
|
||||
cachedImage = newCachedImage;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void Component::setBufferedToImage (const bool shouldBeBuffered)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ public:
|
|||
*/
|
||||
virtual void componentVisibilityChanged() = 0;
|
||||
|
||||
/** Returns the component that's being watched. */
|
||||
Component* getComponent() const noexcept { return component; }
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void componentParentHierarchyChanged (Component& component);
|
||||
|
|
|
|||
|
|
@ -63,11 +63,10 @@ public:
|
|||
|
||||
if (topComp->getPeer() != nullptr)
|
||||
{
|
||||
const Point<int> pos (topComp->getLocalPoint (&owner, Point<int>()));
|
||||
const Rectangle<int> area (topComp->getLocalArea (&owner, owner.getLocalBounds()));
|
||||
|
||||
NSRect r = NSMakeRect ((float) pos.getX(), (float) pos.getY(), (float) owner.getWidth(), (float) owner.getHeight());
|
||||
NSRect r = NSMakeRect ((float) area.getX(), (float) area.getY(), (float) area.getWidth(), (float) area.getHeight());
|
||||
r.origin.y = [[view superview] frame].size.height - (r.origin.y + r.size.height);
|
||||
|
||||
[view setFrame: r];
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +82,7 @@ public:
|
|||
|
||||
if (peer != nullptr)
|
||||
{
|
||||
NSView* peerView = (NSView*) peer->getNativeHandle();
|
||||
NSView* const peerView = (NSView*) peer->getNativeHandle();
|
||||
[peerView addSubview: view];
|
||||
componentMovedOrResized (false, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ void OpenGLHelpers::drawTriangleStrip (const GLfloat* const vertices, const GLfl
|
|||
{
|
||||
#if ! JUCE_ANDROID
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
clearGLError();
|
||||
#endif
|
||||
glDisableClientState (GL_COLOR_ARRAY);
|
||||
glDisableClientState (GL_NORMAL_ARRAY);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue