1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 03:54:40 +00:00

Fix trade windows crashing after a new game

This commit is contained in:
scrawl 2013-11-16 22:29:40 +01:00
parent e32c73725c
commit 7eb1dcb682
2 changed files with 8 additions and 3 deletions

View File

@ -220,11 +220,13 @@ namespace MWGui
mDisposeCorpseButton->setVisible(loot);
setTitle(MWWorld::Class::get(container).getName(container));
mSortModel = new SortFilterItemModel(mModel);
mItemView->setModel (mSortModel);
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
// or we end up using a possibly invalid model.
setTitle(MWWorld::Class::get(container).getName(container));
}
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)

View File

@ -82,7 +82,6 @@ namespace MWGui
void TradeWindow::startTrade(const MWWorld::Ptr& actor)
{
mPtr = actor;
setTitle(MWWorld::Class::get(actor).getName(actor));
mCurrentBalance = 0;
mCurrentMerchantOffer = 0;
@ -99,6 +98,10 @@ namespace MWGui
mItemView->setModel (mSortModel);
updateLabels();
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
// or we end up using a possibly invalid model.
setTitle(MWWorld::Class::get(actor).getName(actor));
}
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)