Missing include ScopedValueSetter latest tip


#1

I had to add

#include “…/containers/juce_ScopedValueSetter.h”

to juce_win32_NativeCode.cpp in order to get it to compile, other than that everything was fine.


#2

Doh! Thanks, I’ll add that…


#3

I don’t understand if my problem is related to this. On Visual Studio 2012 I get this error:

1>c:\users\carlo.chiari\documents\visual studio 2012\projects\c\batchreport\jucelibrarycode\modules\juce_data_structures\values/juce_Value.cpp(61): error C2664: 'juce::ScopedValueSetter<ValueType>::ScopedValueSetter(ValueType &,const ValueType &,const ValueType &)' : cannot convert parameter 2 from 'nullptr' to 'juce::SortedSet<ElementType> &'
1>          with
1>          [
1>              ValueType=juce::SharedValueSourceUpdater::SourceSet *
1>          ]
1>          and
1>          [
1>              ElementType=juce::Value::ValueSource *
1>          ] (..\..\JuceLibraryCode\modules\juce_data_structures\juce_data_structures.cpp)
1>          nullptr can only be converted to pointer or handle types

It refers to this line of code inside juce_value.cpp, I’m using juce-2.0.38-24.

private:
    typedef SortedSet<Value::ValueSource*> SourceSet;
    SourceSet sourcesNeedingAnUpdate;
    SourceSet* sourcesBeingIterated;

    void handleAsyncUpdate()
    {
        const ReferenceCountedObjectPtr<SharedValueSourceUpdater> localRef (this);

        {
            const ScopedValueSetter<SourceSet*> inside (sourcesBeingIterated, nullptr, nullptr);
            int maxLoops = 10;

            while (sourcesNeedingAnUpdate.size() > 0)
            {
                if (--maxLoops == 0)
                {
                    triggerAsyncUpdate();
                    break;
                }

                SourceSet sources;
                sources.swapWith (sourcesNeedingAnUpdate);
                sourcesBeingIterated = &sources;

#4

Hmm, I think VS is being a bit silly with that error, but I will tweak that class slightly because the references aren’t really necessary… Try again now.