Don't invalidate iterators while using range-for
Component's destructor will remove itself from m_components, which would invalidate iterators; instead delete after the for-loop. Thanks for Fabian Vogt for pointing out the exact issue.
Also mark that method as non const, deleteing a Component modifies m_components.