Patch #1538 2006-10-08 14:16

jthedering

Assert failure fixes
Download
1538-Assert_failure.patch (15.4 KB)
Category
Application::Bugfix
Status
Out of date
Close date
2007-04-12 12:43
Assigned to
 
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp    (Revision 3882)
+++ src/sdk/projectmanager.cpp    (Arbeitskopie)
@@ -2031,7 +2031,8 @@
 void ProjectManager::OnRemoveFileFromProject(wxCommandEvent& event)
 {
     wxTreeItemId sel = m_pTree->GetSelection();
-    FileTreeData* ftd = (FileTreeData*)m_pTree->GetItemData(sel);
+    FileTreeData* ftd = NULL;
+    if (sel.IsOk()) ftd = (FileTreeData*)m_pTree->GetItemData(sel);
     if (!ftd)
         return;
     cbProject* prj = ftd->GetProject();
Index: src/sdk/editorconfigurationdlg.cpp
===================================================================
--- src/sdk/editorconfigurationdlg.cpp    (Revision 3882)
+++ src/sdk/editorconfigurationdlg.cpp    (Arbeitskopie)
@@ -282,6 +282,11 @@
 void EditorConfigurationDlg::UpdateListbookImages()
 {
     wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
+    
+    //If this function is called while loading the dialog from XRC (imagelist not assigned yet)
+    if(!lb->GetImageList())
+        return;
+    
     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)
Index: src/sdk/virtualbuildtargetsdlg.cpp
===================================================================
--- src/sdk/virtualbuildtargetsdlg.cpp    (Revision 3882)
+++ src/sdk/virtualbuildtargetsdlg.cpp    (Arbeitskopie)
@@ -39,13 +39,14 @@
 
     // fill aliases
     wxArrayString virtuals = m_pProject->GetVirtualBuildTargets();
-    lstAliases->Set(virtuals);
-    lstAliases->SetSelection(0);
+    lstAliases->Set(virtuals);
+    if (!virtuals.IsEmpty())
+        lstAliases->SetSelection(0);
 
     // fill build targets
     for (int i = 0; i < m_pProject->GetBuildTargetsCount(); ++i)
-        lstTargets->Append(m_pProject->GetBuildTarget(i)->GetTitle());
-    CheckTargets();
+        lstTargets->Append(m_pProject->GetBuildTarget(i)->GetTitle());
+    CheckTargets();
 }
 
 VirtualBuildTargetsDlg::~VirtualBuildTargetsDlg()
Index: src/sdk/uservarmanager.cpp
===================================================================
--- src/sdk/uservarmanager.cpp    (Revision 3882)
+++ src/sdk/uservarmanager.cpp    (Arbeitskopie)
@@ -540,7 +540,10 @@
     for(unsigned int i = 0; i < builtinMembers.GetCount(); ++i)
     {
         ((wxTextCtrl*) FindWindow(builtinMembers[i]))->SetValue(cfg->Read(path + builtinMembers[i]));
-        knownMembers.RemoveAt(knownMembers.Index(builtinMembers[i], false));
+        
+        int index=knownMembers.Index(builtinMembers[i], false);
+        if(index != wxNOT_FOUND)
+            knownMembers.RemoveAt(index);
     }
 
     for(unsigned int i = 0; i < 7; ++i)
@@ -608,7 +611,7 @@
     selVar->Append(vars);
 
 
-    if(currentVar.IsEmpty())
+    if(currentVar.IsEmpty() && !selVar->IsEmpty())
         currentVar = selVar->GetString(0);
 
     selSet->SetStringSelection(currentSet);
Index: src/plugins/debuggergdb/debuggertree.cpp
===================================================================
--- src/plugins/debuggergdb/debuggertree.cpp    (Revision 3882)
+++ src/plugins/debuggergdb/debuggertree.cpp    (Arbeitskopie)
@@ -567,7 +567,10 @@
     wxMenu menu(wxEmptyString);
 
     // if we right-clicked on a pointer, add a "dereference pointer" entry
-    wxString itemtext = m_pTree->GetItemText(id);
+    wxString itemtext;
+    if(id.IsOk())
+        itemtext = m_pTree->GetItemText(id);
+    
     if (itemtext.Find(_T('*')) != wxNOT_FOUND)
     {
         menu.Append(idDereferenceValue, wxString::Format(_("Dereference pointer '%s'"), itemtext.BeforeFirst(_T('=')).c_str()));
@@ -579,12 +582,15 @@
     menu.Append(idWatchThis, _("Watch '*&this'"));
 
     // we have to have a valid id for the following to be enabled
-    WatchTreeData* data = dynamic_cast<WatchTreeData*>(m_pTree->GetItemData(id));
-    if (id.IsOk() && // valid item
-        data && data->m_pWatch) // *is* a watch
+    if (id.IsOk()) // valid item
     {
-        menu.Append(idEditWatch, _("&Edit watch"));
-        menu.Append(idDeleteWatch, _("&Delete watch"));
+        WatchTreeData* data = dynamic_cast<WatchTreeData*>(m_pTree->GetItemData(id));
+        
+        if(data && data->m_pWatch) // *is* a watch
+        {
+            menu.Append(idEditWatch, _("&Edit watch"));
+            menu.Append(idDeleteWatch, _("&Delete watch"));
+        }
     }
     menu.AppendSeparator();
     menu.Append(idChangeValue, _("&Change value..."));
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp    (Revision 3882)
+++ src/plugins/codecompletion/nativeparser.cpp    (Arbeitskopie)
@@ -1132,8 +1132,9 @@
             --x;
 
         if (x > 0 &&
-            (line.GetChar(x) == '>' && line.GetChar(x - 1) == '-') ||
-            (line.GetChar(x) == ':' && line.GetChar(x -
download for full patch...
jthedering 2006-10-08 14:31

If you apply the patches #1308, #1538 and #1539 you should be able to use codeblocks in debug mode without any assert failures (apart from those that I didn't find).

Unluckily this patch changes many files, but the changes are usually very small and thus shouldn't require much testing (Most of them just check a condition).

mandrav 2007-04-12 12:43

I know it is our fault (for taking so long to test and apply it), but this patch is now out of date (source code has changed since you submitted this patch).

If possible, please re-submit it for the current svn code and since you will do that, please submit separate patches for contrib plugins because they would have to be approved by their respective authors.

Thank you for your efforts.

jthedering 2007-04-23 23:32

Thank you for your interest.

This is a remade version of the patch for the latest svn code (revision 3882). I have removed the changes to the contrib plugins. I hope you can apply this patch soon now.