ColourSelector not work in juce plug -in

Customized a class LayerComponent which contains several child components in juce plug-in project, define the object array of this LayerComponent class in Editor: juce::OwnedArray layers; and also a int object layerindexforcolouring which is used to The store whic layer user need to set up colour, the code as below shows.

But after running the code: the color returned by ColourSelector is not the color chosen by the user, the color returned by ColourSelector is set early in “colourSelector->setCurrentColour(layer->getBackgroundColour(false))” .

now what should I do to get the colour correctly from ColourSelector which is chosen by the user?

I will be grateful.

void DivisimateAudioProcessorEditor::mouseDown(const juce::MouseEvent& event)
    if (!layers.isEmpty())
        for (int i = 0; i < layers.size(); i++)
            LayerComponent* layer = layers[i];
            if (event.eventComponent == &layer->layercolourlabel)
               auto  colourSelector = std::make_unique<ColourSelector>(ColourSelector::showAlphaChannel
                    | ColourSelector::showColourAtTop
                    | ColourSelector::editableColour
                    | ColourSelector::showSliders
                    | ColourSelector::showColourspace);
                colourSelector->setColour(ColourSelector::backgroundColourId, Colours::transparentBlack);
                colourSelector->setSize(300, 200);
                layerindexforcolouring = i;
                juce::CallOutBox::launchAsynchronously(std::move(colourSelector), event.eventComponent->getScreenBounds(), nullptr);
 void DivisimateAudioProcessorEditor::changeListenerCallback(juce::ChangeBroadcaster* source)
        if (auto* cs = dynamic_cast<ColourSelector*> (source)) 
         juce::Colour csc = cs->getCurrentColour();         
             LayerComponent* layer = layers[layerindexforcolouring];
             xml.UpdateXML("LayerParameters","layerColour" + juce::String(layerindexforcolouring),csc.toString());