Author Topic: Fix compiler invalid bug, when the default compiler does not exist  (Read 5017 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Two-compiler, one is VC9, one is MinGW, and the MinGW is set as the default compiler.
If the default compiler paths are changed, such as from "C:\MinGW" into the "C:\Test".

Restart CB, created VC project, will find "compile current file" and "Run" function is invalid!
The reason is :
Code
ProjectBuildTarget* target; // target == NULL

Code
Index: src/plugins/compilergcc/compilergcc.cpp

===================================================================

--- src/plugins/compilergcc/compilergcc.cpp (revision 6202)

+++ src/plugins/compilergcc/compilergcc.cpp (working copy)

@@ -1727,6 +1727,10 @@

             return RunSingleFile(Manager::Get()->GetEditorManager()->GetActiveEditor()->GetFilename());
         return -1;
     }
+    else
+    {
+        target = m_Project->GetBuildTarget(m_Project->GetActiveBuildTarget());
+    }
     DoPrepareQueue();
     if (!CompilerValid(target))
         return -1;
@@ -2912,8 +2916,14 @@

 
 int CompilerGCC::CompileFile(const wxString& file)
 {
+    ProjectBuildTarget* target = NULL;
+    if (CheckProject())
+    {
+        target = m_Project->GetBuildTarget(m_Project->GetActiveBuildTarget());
+    }
+
     DoPrepareQueue();
-    if (!CompilerValid())
+    if (!CompilerValid(target))
         return -1;
 
     ProjectFile* pf = m_Project ? m_Project->GetFileByFilename(file, true, false) : 0;


[attachment deleted by admin]