Browse files

Merge pull request #1244 from pieh/dialog_select_reload_crash

GUIDialogSelect: fix crashes on skin reload when select dialog is active
  • Loading branch information...
2 parents 18f522e + 6d1aeac commit 7793f7d92ee45111f238d67aa03ca977e39dec53 @jmarshallnz jmarshallnz committed Nov 16, 2012
Showing with 11 additions and 12 deletions.
  1. +1 −1 xbmc/addons/GUIWindowAddonBrowser.cpp
  2. +10 −10 xbmc/dialogs/GUIDialogSelect.cpp
  3. +0 −1 xbmc/dialogs/GUIDialogSelect.h
View
2 xbmc/addons/GUIWindowAddonBrowser.cpp
@@ -471,7 +471,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, CStd
g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
return 2;
}
- if (!multipleSelection && dialog->GetSelectedLabel() == -1)
+ if (!dialog->IsConfirmed())
return 0;
addonIDs.clear();
const CFileItemList& list = dialog->GetSelectedItems();
View
20 xbmc/dialogs/GUIDialogSelect.cpp
@@ -35,17 +35,16 @@ CGUIDialogSelect::CGUIDialogSelect(void)
m_bButtonEnabled = false;
m_buttonString = -1;
m_useDetails = false;
- m_vecListInternal = new CFileItemList;
+ m_vecList = new CFileItemList;
m_selectedItems = new CFileItemList;
m_multiSelection = false;
- m_vecList = m_vecListInternal;
m_iSelected = -1;
m_loadType = KEEP_IN_MEMORY;
}
CGUIDialogSelect::~CGUIDialogSelect(void)
{
- delete m_vecListInternal;
+ delete m_vecList;
delete m_selectedItems;
}
@@ -76,8 +75,7 @@ bool CGUIDialogSelect::OnMessage(CGUIMessage& message)
}
}
- m_vecListInternal->Clear();
- m_vecList = m_vecListInternal;
+ m_vecList->Clear();
m_buttonString = -1;
SET_CONTROL_LABEL(CONTROL_BUTTON, "");
@@ -158,15 +156,14 @@ void CGUIDialogSelect::Reset()
m_useDetails = false;
m_multiSelection = false;
m_iSelected = -1;
- m_vecListInternal->Clear();
+ m_vecList->Clear();
m_selectedItems->Clear();
- m_vecList = m_vecListInternal;
}
void CGUIDialogSelect::Add(const CStdString& strLabel)
{
CFileItemPtr pItem(new CFileItem(strLabel));
- m_vecListInternal->Add(pItem);
+ m_vecList->Add(pItem);
}
void CGUIDialogSelect::Add(const CFileItemList& items)
@@ -181,12 +178,15 @@ void CGUIDialogSelect::Add(const CFileItemList& items)
void CGUIDialogSelect::Add(const CFileItem* pItem)
{
CFileItemPtr item(new CFileItem(*pItem));
- m_vecListInternal->Add(item);
+ m_vecList->Add(item);
}
void CGUIDialogSelect::SetItems(CFileItemList* pList)
{
- m_vecList = pList;
+ // need to make internal copy of list to be sure dialog is owner of it
+ m_vecList->Clear();
+ if (pList)
+ m_vecList->Copy(*pList);
}
int CGUIDialogSelect::GetSelectedLabel() const
View
1 xbmc/dialogs/GUIDialogSelect.h
@@ -69,7 +69,6 @@ class CGUIDialogSelect :
bool m_multiSelection;
CFileItemList* m_selectedItems;
- CFileItemList* m_vecListInternal;
CFileItemList* m_vecList;
CGUIViewControl m_viewControl;
};

0 comments on commit 7793f7d

Please sign in to comment.