Fix crashes and mismatched tabs in TabView.

* Default BTab uses view's name property as tab label, so
  SetLabel changes that value. However, view names are important
  for yab and this would cause inconsistencies in view lists yab
  stores for referencing them by name. Views attached to tabs would
  not be removed because there is no name "Tab1" in the index
  (there is "Test1", which is the view's original name).
  Later, when asking for view with the same name created later yab
  could get wrong view (if lucky) or crash (if unlucky).
  This commit fixes that by storing original name in YabView
  property, and using that for removing views from the hierarchy.
* Fixes #5.
This commit is contained in:
Kacper Kasper
2018-04-15 17:48:44 +02:00
parent 0aecb50e0e
commit 076496e45d
3 changed files with 14 additions and 6 deletions

View File

@@ -392,7 +392,7 @@ int YabInterface::CloseWindow(const char* view)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@@ -409,7 +409,7 @@ int YabInterface::CloseWindow(const char* view)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))
@@ -3385,7 +3385,7 @@ void YabInterface::WindowClear(const char* window)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@@ -3400,7 +3400,7 @@ void YabInterface::WindowClear(const char* window)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))
@@ -3465,7 +3465,7 @@ void YabInterface::RemoveView(BView *myView)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@@ -3480,7 +3480,7 @@ void YabInterface::RemoveView(BView *myView)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))