# HG changeset patch # User helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1289332546 0 # Node ID eb9cad5fb771e26308ed32498982c3aa64b72bc2 # Parent 20d1d695bf4794b2110ce617f937afc30174fa97 * Fixed the Map editor crashes. The problem was a not cleaned RenderList in testRenderedViewPort(). This fixes also the same problem for the getMatchingInstances() functions. fixes[ticket:500] diff -r 20d1d695bf47 -r eb9cad5fb771 engine/core/view/camera.cpp --- a/engine/core/view/camera.cpp Tue Nov 09 15:46:04 2010 +0000 +++ b/engine/core/view/camera.cpp Tue Nov 09 19:55:46 2010 +0000 @@ -416,10 +416,10 @@ const std::list& layers = map->getLayers(); std::list::const_iterator layer_it = layers.begin(); + m_layer_to_instances.clear(); const RenderList& layer_instances = m_layer_to_instances[*layer_it]; RenderList::const_iterator instance_it = layer_instances.begin(); for(; instance_it != layer_instances.end(); ++instance_it) { - Instance* i = (*instance_it)->instance; const RenderItem& vc = **instance_it; if(vc.dimensions.intersects(rec1) && !trec1) { trec1 = true; @@ -434,7 +434,6 @@ if(trec1 && trec2) { RenderList::const_reverse_iterator instance_itr = layer_instances.rbegin(); for(; instance_itr != layer_instances.rend(); ++instance_itr) { - Instance* i = (*instance_itr)->instance; const RenderItem& vc = **instance_itr; if(vc.dimensions.intersects(rec3) && !trec3) { trec3 = true; @@ -456,6 +455,7 @@ void Camera::getMatchingInstances(ScreenPoint screen_coords, Layer& layer, std::list& instances) { instances.clear(); + m_layer_to_instances.clear(); const RenderList& layer_instances = m_layer_to_instances[&layer]; RenderList::const_iterator instance_it = layer_instances.end(); while (instance_it != layer_instances.begin()) { @@ -488,6 +488,7 @@ void Camera::getMatchingInstances(Rect screen_rect, Layer& layer, std::list& instances) { instances.clear(); + m_layer_to_instances.clear(); const RenderList& layer_instances = m_layer_to_instances[&layer]; RenderList::const_iterator instance_it = layer_instances.end(); while (instance_it != layer_instances.begin()) { @@ -528,6 +529,7 @@ void Camera::getMatchingInstances(Location& loc, std::list& instances, bool use_exactcoordinates) { instances.clear(); + m_layer_to_instances.clear(); const RenderList& layer_instances = m_layer_to_instances[loc.getLayer()]; RenderList::const_iterator instance_it = layer_instances.end(); while (instance_it != layer_instances.begin()) {