| @@ -1895,7 +1895,7 @@ var JavascriptEngine::callFunctionObject (DynamicObject* objectScope, const var& | |||||
| prepareTimeout(); | prepareTimeout(); | ||||
| if (result != nullptr) *result = Result::ok(); | if (result != nullptr) *result = Result::ok(); | ||||
| RootObject::Scope rootScope ({}, *root, *root); | RootObject::Scope rootScope ({}, *root, *root); | ||||
| RootObject::Scope (&rootScope, *root, DynamicObject::Ptr (objectScope)) | |||||
| RootObject::Scope (&rootScope, *root, DynamicObject::Ptr (objectScope)) | |||||
| .invokeMethod (functionObject, args, returnVal); | .invokeMethod (functionObject, args, returnVal); | ||||
| } | } | ||||
| catch (String& error) | catch (String& error) | ||||
| @@ -160,7 +160,7 @@ struct Expression::Helpers | |||||
| { | { | ||||
| String s; | String s; | ||||
| auto ourPrecendence = getOperatorPrecedence(); | auto ourPrecendence = getOperatorPrecedence(); | ||||
| if (left->getOperatorPrecedence() > ourPrecendence) | if (left->getOperatorPrecedence() > ourPrecendence) | ||||
| s << '(' << left->toString() << ')'; | s << '(' << left->toString() << ')'; | ||||
| else | else | ||||
| @@ -537,7 +537,7 @@ struct Expression::Helpers | |||||
| TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const | TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const | ||||
| { | { | ||||
| auto newDest = createDestinationTerm (scope, input, overallTarget, topLevelTerm); | |||||
| auto newDest = createDestinationTerm (scope, input, overallTarget, topLevelTerm); | |||||
| if (newDest == nullptr) | if (newDest == nullptr) | ||||
| return {}; | return {}; | ||||
| @@ -774,7 +774,7 @@ struct Expression::Helpers | |||||
| { | { | ||||
| auto lhs = readMultiplyOrDivideExpression(); | auto lhs = readMultiplyOrDivideExpression(); | ||||
| char opType; | char opType; | ||||
| while (lhs != nullptr && readOperator ("+-", &opType)) | while (lhs != nullptr && readOperator ("+-", &opType)) | ||||
| { | { | ||||
| auto rhs = readMultiplyOrDivideExpression(); | auto rhs = readMultiplyOrDivideExpression(); | ||||
| @@ -795,7 +795,7 @@ struct Expression::Helpers | |||||
| { | { | ||||
| auto lhs = readUnaryExpression(); | auto lhs = readUnaryExpression(); | ||||
| char opType; | char opType; | ||||
| while (lhs != nullptr && readOperator ("*/", &opType)) | while (lhs != nullptr && readOperator ("*/", &opType)) | ||||
| { | { | ||||
| TermPtr rhs (readUnaryExpression()); | TermPtr rhs (readUnaryExpression()); | ||||
| @@ -844,7 +844,7 @@ struct Expression::Helpers | |||||
| TermPtr readSymbolOrFunction() | TermPtr readSymbolOrFunction() | ||||
| { | { | ||||
| String identifier; | |||||
| String identifier; | |||||
| if (readIdentifier (identifier)) | if (readIdentifier (identifier)) | ||||
| { | { | ||||
| @@ -907,7 +907,7 @@ struct Expression::Helpers | |||||
| if (! readOperator ("(")) | if (! readOperator ("(")) | ||||
| return {}; | return {}; | ||||
| auto e = readExpression(); | |||||
| auto e = readExpression(); | |||||
| if (e == nullptr || ! readOperator (")")) | if (e == nullptr || ! readOperator (")")) | ||||
| return {}; | return {}; | ||||
| @@ -260,15 +260,15 @@ public: | |||||
| incIfNotNull (refCountedObject); | incIfNotNull (refCountedObject); | ||||
| } | } | ||||
| /** Creates a pointer to an object. | |||||
| This will increment the object's reference-count. | |||||
| */ | |||||
| ReferenceCountedObjectPtr (ReferencedType& refCountedObject) noexcept | |||||
| : referencedObject (&refCountedObject) | |||||
| { | |||||
| refCountedObject.incReferenceCount(); | |||||
| } | |||||
| /** Creates a pointer to an object. | |||||
| This will increment the object's reference-count. | |||||
| */ | |||||
| ReferenceCountedObjectPtr (ReferencedType& refCountedObject) noexcept | |||||
| : referencedObject (&refCountedObject) | |||||
| { | |||||
| refCountedObject.incReferenceCount(); | |||||
| } | |||||
| /** Copies another pointer. | /** Copies another pointer. | ||||
| This will increment the object's reference-count. | This will increment the object's reference-count. | ||||
| */ | */ | ||||
| @@ -319,40 +319,40 @@ public: | |||||
| The reference count of the old object is decremented, and it might be | The reference count of the old object is decremented, and it might be | ||||
| deleted if it hits zero. The new object's count is incremented. | deleted if it hits zero. The new object's count is incremented. | ||||
| */ | */ | ||||
| ReferenceCountedObjectPtr& operator= (ReferencedType* newObject) | |||||
| { | |||||
| if (newObject != nullptr) | |||||
| return operator= (*newObject); | |||||
| reset(); | |||||
| return *this; | |||||
| } | |||||
| /** Changes this pointer to point at a different object. | |||||
| The reference count of the old object is decremented, and it might be | |||||
| deleted if it hits zero. The new object's count is incremented. | |||||
| */ | |||||
| ReferenceCountedObjectPtr& operator= (ReferencedType& newObject) | |||||
| { | |||||
| if (referencedObject != &newObject) | |||||
| { | |||||
| newObject.incReferenceCount(); | |||||
| auto* oldObject = referencedObject; | |||||
| referencedObject = &newObject; | |||||
| decIfNotNull (oldObject); | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| /** Resets this pointer to a null pointer. */ | |||||
| ReferenceCountedObjectPtr& operator= (decltype (nullptr)) | |||||
| { | |||||
| reset(); | |||||
| return *this; | |||||
| } | |||||
| ReferenceCountedObjectPtr& operator= (ReferencedType* newObject) | |||||
| { | |||||
| if (newObject != nullptr) | |||||
| return operator= (*newObject); | |||||
| reset(); | |||||
| return *this; | |||||
| } | |||||
| /** Changes this pointer to point at a different object. | |||||
| The reference count of the old object is decremented, and it might be | |||||
| deleted if it hits zero. The new object's count is incremented. | |||||
| */ | |||||
| ReferenceCountedObjectPtr& operator= (ReferencedType& newObject) | |||||
| { | |||||
| if (referencedObject != &newObject) | |||||
| { | |||||
| newObject.incReferenceCount(); | |||||
| auto* oldObject = referencedObject; | |||||
| referencedObject = &newObject; | |||||
| decIfNotNull (oldObject); | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| /** Resets this pointer to a null pointer. */ | |||||
| ReferenceCountedObjectPtr& operator= (decltype (nullptr)) | |||||
| { | |||||
| reset(); | |||||
| return *this; | |||||
| } | |||||
| /** Takes-over the object from another pointer. */ | /** Takes-over the object from another pointer. */ | ||||
| ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other) noexcept | ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other) noexcept | ||||
| { | { | ||||
| @@ -365,7 +365,7 @@ public: | |||||
| object to be deleted when the ref-count hits zero. | object to be deleted when the ref-count hits zero. | ||||
| */ | */ | ||||
| ~ReferenceCountedObjectPtr() | ~ReferenceCountedObjectPtr() | ||||
| { | |||||
| { | |||||
| reset(); | reset(); | ||||
| } | } | ||||
| @@ -374,12 +374,12 @@ public: | |||||
| The pointer returned may be null, of course. | The pointer returned may be null, of course. | ||||
| */ | */ | ||||
| ReferencedType* get() const noexcept { return referencedObject; } | ReferencedType* get() const noexcept { return referencedObject; } | ||||
| /** Resets this object to a null pointer. */ | |||||
| void reset() noexcept | |||||
| { | |||||
| decIfNotNull (referencedObject); | |||||
| } | |||||
| /** Resets this object to a null pointer. */ | |||||
| void reset() noexcept | |||||
| { | |||||
| decIfNotNull (referencedObject); | |||||
| } | |||||
| // the -> operator is called on the referenced object | // the -> operator is called on the referenced object | ||||
| ReferencedType* operator->() const noexcept | ReferencedType* operator->() const noexcept | ||||
| @@ -389,7 +389,7 @@ public: | |||||
| } | } | ||||
| output.writeCompressedInt (children.size()); | output.writeCompressedInt (children.size()); | ||||
| for (auto* c : children) | for (auto* c : children) | ||||
| writeObjectToStream (output, c); | writeObjectToStream (output, c); | ||||
| } | } | ||||
| @@ -598,9 +598,9 @@ ValueTree::ValueTree (const Identifier& type, | |||||
| addChild (tree, -1, nullptr); | addChild (tree, -1, nullptr); | ||||
| } | } | ||||
| ValueTree::ValueTree (SharedObject::Ptr so) noexcept : object (static_cast<SharedObject::Ptr&&> (so)) {} | |||||
| ValueTree::ValueTree (SharedObject& so) noexcept : object (so) {} | |||||
| ValueTree::ValueTree (SharedObject::Ptr so) noexcept : object (static_cast<SharedObject::Ptr&&> (so)) {} | |||||
| ValueTree::ValueTree (SharedObject& so) noexcept : object (so) {} | |||||
| ValueTree::ValueTree (const ValueTree& other) noexcept : object (other.object) | ValueTree::ValueTree (const ValueTree& other) noexcept : object (other.object) | ||||
| { | { | ||||
| } | } | ||||
| @@ -661,10 +661,10 @@ bool ValueTree::isEquivalentTo (const ValueTree& other) const | |||||
| } | } | ||||
| ValueTree ValueTree::createCopy() const | ValueTree ValueTree::createCopy() const | ||||
| { | |||||
| if (object != nullptr) | |||||
| return ValueTree (*new SharedObject (*object)); | |||||
| { | |||||
| if (object != nullptr) | |||||
| return ValueTree (*new SharedObject (*object)); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| @@ -701,29 +701,29 @@ Identifier ValueTree::getType() const noexcept | |||||
| } | } | ||||
| ValueTree ValueTree::getParent() const noexcept | ValueTree ValueTree::getParent() const noexcept | ||||
| { | |||||
| if (object != nullptr) | |||||
| if (auto p = object->parent) | |||||
| return ValueTree (*p); | |||||
| { | |||||
| if (object != nullptr) | |||||
| if (auto p = object->parent) | |||||
| return ValueTree (*p); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| ValueTree ValueTree::getRoot() const noexcept | ValueTree ValueTree::getRoot() const noexcept | ||||
| { | { | ||||
| if (object != nullptr) | |||||
| return ValueTree (object->getRoot()); | |||||
| if (object != nullptr) | |||||
| return ValueTree (object->getRoot()); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| ValueTree ValueTree::getSibling (int delta) const noexcept | ValueTree ValueTree::getSibling (int delta) const noexcept | ||||
| { | { | ||||
| if (object == nullptr) | |||||
| if (auto p = object->parent) | |||||
| if (auto c = p->children.getObjectPointer (p->indexOf (*this) + delta)) | |||||
| return ValueTree (*c); | |||||
| if (object == nullptr) | |||||
| if (auto p = object->parent) | |||||
| if (auto c = p->children.getObjectPointer (p->indexOf (*this) + delta)) | |||||
| return ValueTree (*c); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| @@ -855,11 +855,11 @@ int ValueTree::getNumChildren() const noexcept | |||||
| } | } | ||||
| ValueTree ValueTree::getChild (int index) const | ValueTree ValueTree::getChild (int index) const | ||||
| { | |||||
| if (object != nullptr) | |||||
| if (auto c = object->children.getObjectPointer (index)) | |||||
| return ValueTree (*c); | |||||
| { | |||||
| if (object != nullptr) | |||||
| if (auto c = object->children.getObjectPointer (index)) | |||||
| return ValueTree (*c); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| @@ -954,10 +954,10 @@ void ValueTree::createListOfChildren (OwnedArray<ValueTree>& list) const | |||||
| { | { | ||||
| jassert (object != nullptr); | jassert (object != nullptr); | ||||
| for (auto* o : object->children) | |||||
| { | |||||
| for (auto* o : object->children) | |||||
| { | |||||
| jassert (o != nullptr); | jassert (o != nullptr); | ||||
| list.add (new ValueTree (*o)); | |||||
| list.add (new ValueTree (*o)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -632,8 +632,8 @@ private: | |||||
| void createListOfChildren (OwnedArray<ValueTree>&) const; | void createListOfChildren (OwnedArray<ValueTree>&) const; | ||||
| void reorderChildren (const OwnedArray<ValueTree>&, UndoManager*); | void reorderChildren (const OwnedArray<ValueTree>&, UndoManager*); | ||||
| explicit ValueTree (ReferenceCountedObjectPtr<SharedObject>) noexcept; | |||||
| explicit ValueTree (SharedObject&) noexcept; | |||||
| explicit ValueTree (ReferenceCountedObjectPtr<SharedObject>) noexcept; | |||||
| explicit ValueTree (SharedObject&) noexcept; | |||||
| }; | }; | ||||
| } // namespace juce | } // namespace juce | ||||
| @@ -589,24 +589,24 @@ public: | |||||
| void execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool shouldBlock, bool calledFromDestructor = false) | void execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool shouldBlock, bool calledFromDestructor = false) | ||||
| { | { | ||||
| if (calledFromDestructor || destroying.get() == 0) | if (calledFromDestructor || destroying.get() == 0) | ||||
| { | |||||
| if (shouldBlock) | |||||
| { | |||||
| auto blocker = new BlockingWorker (static_cast<OpenGLContext::AsyncWorker::Ptr&&> (workerToUse)); | |||||
| OpenGLContext::AsyncWorker::Ptr worker (*blocker); | |||||
| workQueue.add (worker); | |||||
| messageManagerLock.abort(); | |||||
| context.triggerRepaint(); | |||||
| blocker->block(); | |||||
| } | |||||
| else | |||||
| { | |||||
| { | |||||
| if (shouldBlock) | |||||
| { | |||||
| auto blocker = new BlockingWorker (static_cast<OpenGLContext::AsyncWorker::Ptr&&> (workerToUse)); | |||||
| OpenGLContext::AsyncWorker::Ptr worker (*blocker); | |||||
| workQueue.add (worker); | |||||
| messageManagerLock.abort(); | |||||
| context.triggerRepaint(); | |||||
| blocker->block(); | |||||
| } | |||||
| else | |||||
| { | |||||
| workQueue.add (static_cast<OpenGLContext::AsyncWorker::Ptr&&> (workerToUse)); | workQueue.add (static_cast<OpenGLContext::AsyncWorker::Ptr&&> (workerToUse)); | ||||
| messageManagerLock.abort(); | messageManagerLock.abort(); | ||||
| context.triggerRepaint(); | |||||
| context.triggerRepaint(); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -1844,7 +1844,7 @@ struct CustomProgram : public ReferenceCountedObject, | |||||
| static ReferenceCountedObjectPtr<CustomProgram> get (const String& hashName) | static ReferenceCountedObjectPtr<CustomProgram> get (const String& hashName) | ||||
| { | { | ||||
| if (auto* c = OpenGLContext::getCurrentContext()) | |||||
| if (auto* c = OpenGLContext::getCurrentContext()) | |||||
| if (auto* o = c->getAssociatedObject (hashName.toRawUTF8())) | if (auto* o = c->getAssociatedObject (hashName.toRawUTF8())) | ||||
| return *static_cast<CustomProgram*> (o); | return *static_cast<CustomProgram*> (o); | ||||