Skip to content

add virtual functions to tiles

this PR adds a virtual destructor to the AbstractMarkerTiler::Tile hierarchy. this increases the memory footprint of a Tile by one pointer size. but a tile with children already had 100 pointers. so I'd argue this is marginal (and one of the child classes already had a virtual dtor).

as this PR mostly deletes code, i hope it is relatively small. below a more detailed summary of the changes.

previously memory had to be managed by the concrete classes GPSMarkerTiler and ItemMarkerTiler by casting to the correct subclass before deleting an instance of a Tile. so memory management was cumbersome and potentially error prone.

this PR deletes the tileDeleteChildren/tileDelete/tileDeleteChild functions on the concrete classes and move memory management to the base class. a function Tile::deleteChild was added wich combines the previous indexOfChild and clearChild functions. only creation of the correct Tile class is still handled by the tileNew() function.

the root tile is now held in a QScopedPointer and the AbstractMarkerTiler::Tile class manages the memory of its children after they got added via AbstractMarkerTiler::Tile::addChild. They will be deleted either by a call to deleteChild or in the virtual destructor of Tile.

Edited by justus schwartz

Merge request reports