Bug in RectangleList::add(const RectangleList& other)


#1

I believe this is a bug we stumbled upon, but I’m surprised it’s still in the code, so either we are missing something or nobody is using RectangleList::add() to add a RectangleList to anoher? Try to compile something like this and you will get an error:

void TestRectangleList()
{
    RectangleList<int> r1; 
    RectangleList<int> r2;
    r1.add(r2);
}

If you look at the RectangleList::add() method around line 194 of juce_RectangleList.h perhaps it should be changed as follows?

void add (const RectangleList& other)
{
-     for (auto& r : other)
-         add (*r);
+    for (const auto& r : other)
+        add (r);
}

Thanks for taking a look!


#2

Blimey, I’m surprised that’s existed for so long…

Thank you for reporting.


#3

Great, thanks for fixing.

Cheers,
Rob