Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: stahta01 on September 18, 2008, 04:45:44 pm

Title: [FIXED] Patch for what I think is an coding bug in compileroptionsdlg.cpp
Post by: stahta01 on September 18, 2008, 04:45:44 pm
FYI:

While trying to patch Code::Blocks for wxWidgets 2.9x I found an place where an string is compared to an int.

Tim S

PS: I have been up for over an day; so, take that into consideration.

excerpt from compilerfactory.h
Code
static const wxString& GetDefaultCompilerID();

excerpt from compileroptionsdlg.cpp
Code
        int idx   = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetSelection();
        int count = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetCount(); // compilers count
        Compiler* compiler = CompilerFactory::GetCompiler(idx);

        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetDefaultCompilerID() != idx);

Patch that I think is needed
Code
Index: src/plugins/compilergcc/compileroptionsdlg.cpp
===================================================================
--- src/plugins/compilergcc/compileroptionsdlg.cpp (revision 5204)
+++ src/plugins/compilergcc/compileroptionsdlg.cpp (working copy)
@@ -2124,7 +2124,7 @@
         int count = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetCount(); // compilers count
         Compiler* compiler = CompilerFactory::GetCompiler(idx);
 
-        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetDefaultCompilerID() != idx);
+        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetCompilerIndex(CompilerFactory::GetDefaultCompiler()) != idx);
         XRCCTRL(*this, "btnAddCompiler",        wxButton)->Enable(en);
         XRCCTRL(*this, "btnRenameCompiler",     wxButton)->Enable(en && count);
         XRCCTRL(*this, "btnDelCompiler",        wxButton)->Enable(en &&
Title: Re: Patch for what I think is an coding bug in compileroptionsdlg.cpp
Post by: MortenMacFly on September 19, 2008, 08:47:13 am
Patch that I think is needed
Applied in SVN. Thanks!