CMenuWidget: avoid dangling pointer after delete

This commit is contained in:
2016-05-04 17:42:51 +02:00
parent 2dd2fac376
commit 91729dc48a

View File

@@ -677,8 +677,10 @@ void CMenuWidget::resetWidget(bool delete_items)
{ {
for(unsigned int count=0;count<items.size();count++) { for(unsigned int count=0;count<items.size();count++) {
CMenuItem * item = items[count]; CMenuItem * item = items[count];
if (delete_items && !item->isStatic) if (delete_items && !item->isStatic){
delete item; delete item;
item = NULL;
}
} }
items.clear(); items.clear();