| @@ -1895,7 +1895,7 @@ var JavascriptEngine::callFunctionObject (DynamicObject* objectScope, const var& | |||
| prepareTimeout(); | |||
| if (result != nullptr) *result = Result::ok(); | |||
| RootObject::Scope rootScope ({}, *root, *root); | |||
| RootObject::Scope (&rootScope, *root, DynamicObject::Ptr (objectScope)) | |||
| RootObject::Scope (&rootScope, *root, DynamicObject::Ptr (objectScope)) | |||
| .invokeMethod (functionObject, args, returnVal); | |||
| } | |||
| catch (String& error) | |||
| @@ -160,7 +160,7 @@ struct Expression::Helpers | |||
| { | |||
| String s; | |||
| auto ourPrecendence = getOperatorPrecedence(); | |||
| if (left->getOperatorPrecedence() > ourPrecendence) | |||
| s << '(' << left->toString() << ')'; | |||
| else | |||
| @@ -537,7 +537,7 @@ struct Expression::Helpers | |||
| 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) | |||
| return {}; | |||
| @@ -774,7 +774,7 @@ struct Expression::Helpers | |||
| { | |||
| auto lhs = readMultiplyOrDivideExpression(); | |||
| char opType; | |||
| while (lhs != nullptr && readOperator ("+-", &opType)) | |||
| { | |||
| auto rhs = readMultiplyOrDivideExpression(); | |||
| @@ -795,7 +795,7 @@ struct Expression::Helpers | |||
| { | |||
| auto lhs = readUnaryExpression(); | |||
| char opType; | |||
| while (lhs != nullptr && readOperator ("*/", &opType)) | |||
| { | |||
| TermPtr rhs (readUnaryExpression()); | |||
| @@ -844,7 +844,7 @@ struct Expression::Helpers | |||
| TermPtr readSymbolOrFunction() | |||
| { | |||
| String identifier; | |||
| String identifier; | |||
| if (readIdentifier (identifier)) | |||
| { | |||
| @@ -907,7 +907,7 @@ struct Expression::Helpers | |||
| if (! readOperator ("(")) | |||
| return {}; | |||
| auto e = readExpression(); | |||
| auto e = readExpression(); | |||
| if (e == nullptr || ! readOperator (")")) | |||
| return {}; | |||
| @@ -260,15 +260,15 @@ public: | |||
| 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. | |||
| 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 | |||
| 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. */ | |||
| ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other) noexcept | |||
| { | |||
| @@ -365,7 +365,7 @@ public: | |||
| object to be deleted when the ref-count hits zero. | |||
| */ | |||
| ~ReferenceCountedObjectPtr() | |||
| { | |||
| { | |||
| reset(); | |||
| } | |||
| @@ -374,12 +374,12 @@ public: | |||
| The pointer returned may be null, of course. | |||
| */ | |||
| 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 | |||
| ReferencedType* operator->() const noexcept | |||
| @@ -389,7 +389,7 @@ public: | |||
| } | |||
| output.writeCompressedInt (children.size()); | |||
| for (auto* c : children) | |||
| writeObjectToStream (output, c); | |||
| } | |||
| @@ -598,9 +598,9 @@ ValueTree::ValueTree (const Identifier& type, | |||
| 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) | |||
| { | |||
| } | |||
| @@ -661,10 +661,10 @@ bool ValueTree::isEquivalentTo (const ValueTree& other) const | |||
| } | |||
| ValueTree ValueTree::createCopy() const | |||
| { | |||
| if (object != nullptr) | |||
| return ValueTree (*new SharedObject (*object)); | |||
| { | |||
| if (object != nullptr) | |||
| return ValueTree (*new SharedObject (*object)); | |||
| return {}; | |||
| } | |||
| @@ -701,29 +701,29 @@ Identifier ValueTree::getType() 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 {}; | |||
| } | |||
| ValueTree ValueTree::getRoot() const noexcept | |||
| { | |||
| if (object != nullptr) | |||
| return ValueTree (object->getRoot()); | |||
| if (object != nullptr) | |||
| return ValueTree (object->getRoot()); | |||
| return {}; | |||
| } | |||
| 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 {}; | |||
| } | |||
| @@ -855,11 +855,11 @@ int ValueTree::getNumChildren() const noexcept | |||
| } | |||
| 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 {}; | |||
| } | |||
| @@ -954,10 +954,10 @@ void ValueTree::createListOfChildren (OwnedArray<ValueTree>& list) const | |||
| { | |||
| jassert (object != nullptr); | |||
| for (auto* o : object->children) | |||
| { | |||
| for (auto* o : object->children) | |||
| { | |||
| jassert (o != nullptr); | |||
| list.add (new ValueTree (*o)); | |||
| list.add (new ValueTree (*o)); | |||
| } | |||
| } | |||
| @@ -632,8 +632,8 @@ private: | |||
| void createListOfChildren (OwnedArray<ValueTree>&) const; | |||
| 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 | |||
| @@ -589,24 +589,24 @@ public: | |||
| void execute (OpenGLContext::AsyncWorker::Ptr workerToUse, bool shouldBlock, bool calledFromDestructor = false) | |||
| { | |||
| 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)); | |||
| messageManagerLock.abort(); | |||
| context.triggerRepaint(); | |||
| context.triggerRepaint(); | |||
| } | |||
| } | |||
| else | |||
| @@ -1844,7 +1844,7 @@ struct CustomProgram : public ReferenceCountedObject, | |||
| static ReferenceCountedObjectPtr<CustomProgram> get (const String& hashName) | |||
| { | |||
| if (auto* c = OpenGLContext::getCurrentContext()) | |||
| if (auto* c = OpenGLContext::getCurrentContext()) | |||
| if (auto* o = c->getAssociatedObject (hashName.toRawUTF8())) | |||
| return *static_cast<CustomProgram*> (o); | |||