Make sure deleted text items are removed from view and selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/6407
This commit is contained in:
Jeff Young 2020-11-17 20:47:50 +00:00
parent bfc4afc506
commit 54427fd594
3 changed files with 13 additions and 4 deletions

View File

@ -114,12 +114,13 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
KIGFX::GAL* gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
const auto drawList = updateDrawList();
const std::vector<VIEW_ITEM*> drawList = updateDrawList();
std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
// Build a list of layers used by the items in the group
for( auto item : drawList )
for( VIEW_ITEM* item : drawList )
{
int item_layers[VIEW::VIEW_MAX_LAYERS], item_layers_count;
item->ViewGetLayers( item_layers, item_layers_count );

View File

@ -112,7 +112,7 @@ void BOARD_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
void BOARD_ITEM::DeleteStructure()
{
auto parent = GetParent();
BOARD_ITEM_CONTAINER* parent = GetParent();
if( parent )
parent->Remove( this );

View File

@ -44,6 +44,8 @@
#include "3d_cache/dialogs/panel_prev_3d.h"
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <fp_lib_table.h>
@ -632,9 +634,15 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
}
}
// Remove items from m_footprint graphic list:
// Remove text items:
SELECTION_TOOL* selTool = m_frame->GetToolManager()->GetTool<SELECTION_TOOL>();
for( FP_TEXT* item: items_to_remove )
{
selTool->RemoveItemFromSel( item );
view->Remove( item );
item->DeleteStructure();
}
// if there are still grid table entries, create new texts for them
while( i < m_texts->size() )