defocus components removed from scrollpanels, to prevent crashes

This commit is contained in:
jacob1 2013-01-10 12:02:54 -05:00
parent 17302f03c7
commit f814d264b2
3 changed files with 4 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class LoadFilesTask: public Task
{ {
std::vector<unsigned char> data = Client::Ref().ReadFile(*iter); std::vector<unsigned char> data = Client::Ref().ReadFile(*iter);
GameSave * tempSave = new GameSave(data); GameSave * tempSave = new GameSave(data);
saveFile->SetGameSave(tempSave); saveFile->SetGameSave(tempSave);
saveFiles.push_back(saveFile); saveFiles.push_back(saveFile);
std::string filename = *iter; std::string filename = *iter;

View File

@ -82,6 +82,8 @@ void Panel::RemoveChild(Component* c)
{ {
//remove child from parent. Does not free memory //remove child from parent. Does not free memory
children.erase(children.begin() + i); children.erase(children.begin() + i);
if (this->GetParentWindow()->IsFocused(c))
this->GetParentWindow()->FocusComponent(NULL);
break; break;
} }
} }

View File

@ -48,6 +48,7 @@ LocalSaveActivity::LocalSaveActivity(SaveFile save, FileSavedCallback * callback
filenameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; filenameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
filenameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; filenameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
AddComponent(filenameField); AddComponent(filenameField);
FocusComponent(filenameField);
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel"); ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel");
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;