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


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;

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!


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

Thank you for reporting.


Great, thanks for fixing.