Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: devilsclaw on March 30, 2007, 08:51:11 pm

Title: Picture Loading Problem
Post by: devilsclaw on March 30, 2007, 08:51:11 pm


//this code is throwing errors

Code
void EnvironmentSettingsDlg::UpdateListbookImages()
{
wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
int sel = lb->GetSelection();

             // set page images according to their on/off status
for (size_t i = 0; i < (IMAGES_COUNT + m_PluginPanels.GetCount()); i++)
{
    lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));
}

             // the selection colour is ruining the on/off effect,
             // so make sure no item is selected ;)
             // (only if we have icons showing)
if (GetSettingsIconsStyle(lb->GetListView()) != sisNoIcons)
lb->GetListView()->Select(sel, false);

             // update the page title
wxString label = lb->GetPageText(sel);

             // replace any stray & with && because label makes it an underscore
while (label.Replace(_T(" & "), _T(" && ")))
;
XRCCTRL(*this, "lblBigTitle", wxStaticText)->SetLabel(label);
}


//the "lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));" is the problem

Code
             // set page images according to their on/off status
for (size_t i = 0; i < (IMAGES_COUNT + m_PluginPanels.GetCount()); i++)
{
    lb->SetPageImage(i, (i * 2) + (sel == (int)i ? 0 : 1));
}

i have tried just about everything to test to see if i can make it not give errors
each time i do some of the pictures are not loaded


//error output
Code
../src/generic/listctrl.cpp(3697): assert "wxAssertFailure" failed: invalid item index in SetItem

Call stack:
[05] wxStackWalker::Walk(unsigned int)       
[06] 0xb6b24994
[07] 0xb6b24b1c
[08] wxAppConsole::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)
[09] wxApp::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)
[10] wxOnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)
[11] wxAssert(int, wchar_t const*, int, wchar_t const*, wchar_t const*)
[12] wxListMainWindow::SetItem(wxListItem&) 
[13] wxGenericListCtrl::SetItemColumnImage(long, long, int)
[14] wxGenericListCtrl::SetItemImage(long, int, int)
[15] wxListbook::SetPageImage(unsigned int, int)
[16] EnvironmentSettingsDlg::UpdateListbookImages() /storage/root/cb/svn/trunk/src/src/environmentsettingsdlg.cpp:253
[17] EnvironmentSettingsDlg::OnPageChanged(wxListbookEvent&) /storage/root/cb/svn/trunk/src/src/environmentsettingsdlg.cpp:279
[18] wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const
[19] wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[20] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[21] wxEvtHandler::ProcessEvent(wxEvent&)   
[22] wxWindowBase::TryParent(wxEvent&)       
[23] wxEvtHandler::ProcessEvent(wxEvent&)   
[24] wxListbook::SetSelection(unsigned int) 
[25] wxListbook::InsertPage(unsigned int, wxWindow*, wxString const&, bool, int)

i think it might be do to corrupt imagelist being pulled from the plugins in the first place.

there are other windows that do this also like the Setting->Editor does it also

the errors on the Settings->Enviroment only popup 5 times which is for like 5 images comming from the plugins i think.
Title: Re: Picture Loading Problem
Post by: afb on March 30, 2007, 10:04:42 pm
If you want to run Code::Blocks with wxWidgets debugging enabled,
there are some optional patches available that can help you with that...

http://developer.berlios.de/patch/?func=detailpatch&patch_id=1308&group_id=5358
http://developer.berlios.de/patch/?func=detailpatch&patch_id=1538&group_id=5358
http://developer.berlios.de/patch/?func=detailpatch&patch_id=1539&group_id=5358
Eventually they might get folded into main (and wxSmith needs some too)