User forums > Nightly builds
The 21 June 2016 build (10868) is out.
Pecan:
When a workspace with only one project is closed, then another loaded, it's possible for the newly loaded project to be assigned the same memory address as the closed project.
Thus, any test against the previously loaded projects address will match, and macrosmanager.cpp will not replace the macros for the second project.
Below is the fix. I'll apply after review by other team members.
--- Code: ---Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 10889)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -269,7 +269,7 @@
m_Macros[_T("MAKEFILE")] = wxEmptyString;
m_Macros[_T("ALL_PROJECT_FILES")] = wxEmptyString;
}
- else if (project != m_LastProject)
+ else if ( (project != m_LastProject) or (project->GetTitle() != m_ProjectName) )
{
m_LastTarget = nullptr; // reset last target when project changes
m_ProjectWxFileName.Assign(project->GetFilename());
@@ -340,7 +340,7 @@
m_TargetFilename = wxEmptyString;
m_LastTarget = nullptr;
}
- else if (target != m_LastTarget)
+ else if ( (target != m_LastTarget) or (target->GetTitle() != m_TargetName) )
{
wxFileName tod(target->GetOutputFilename());
m_TargetOutputDir = UnixFilename(tod.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
@@ -455,7 +455,8 @@
target = project->GetBuildTarget(project->GetActiveBuildTarget());
}
}
- if (project != m_LastProject || target != m_LastTarget || (editor && (editor->GetFilename() != m_ActiveEditorFilename)) )
+ if (project != m_LastProject || target != m_LastTarget || (editor && (editor->GetFilename() != m_ActiveEditorFilename))
+ || (project && (project->GetTitle() != m_ProjectName)) || (target && (target->GetTitle() != m_TargetName)) )
RecalcVars(project, editor, target);
wxString search;
--- End code ---
blauzahn:
What if the checked attributes of the 2 projects are the same? This is quite probable when
you load a different version of the same project (e.g. a backup). Ideally, the
solution does not depend on any attribute at all. Would it make sense to set
m_LastProject to nullptr on close or would that contradict its purpose?
Until then, I welcome an improvement like yours.
Pecan:
--- Quote from: blauzahn on July 26, 2016, 06:37:55 am ---What if the checked attributes of the 2 projects are the same? ...
--- End quote ---
Good point.
So, we need a unique attribute.
Question: Is it always true that the absolute form of the project filename (.cbp) is unique for all projects?
Pecan:
--- Quote from: blauzahn on July 26, 2016, 06:37:55 am ---What if the checked attributes of the 2 projects are the same?
--- End quote ---
New patch to assure that the secondary attribute comparison is unique.
Also using the shorter comparisons first as a short circuit to the result.
--- Code: ---Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 10889)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -269,7 +269,10 @@
m_Macros[_T("MAKEFILE")] = wxEmptyString;
m_Macros[_T("ALL_PROJECT_FILES")] = wxEmptyString;
}
- else if (project != m_LastProject)
+ else if ( (project != m_LastProject) || (project->GetTitle() != m_ProjectName)
+ || (UnixFilename(project->GetBasePath()) != m_ProjectDir)
+ || (UnixFilename(project->GetFilename()) != m_ProjectFilename)
+ )
{
m_LastTarget = nullptr; // reset last target when project changes
m_ProjectWxFileName.Assign(project->GetFilename());
@@ -340,7 +343,7 @@
m_TargetFilename = wxEmptyString;
m_LastTarget = nullptr;
}
- else if (target != m_LastTarget)
+ else if ( (target != m_LastTarget) or (target->GetTitle() != m_TargetName) )
{
wxFileName tod(target->GetOutputFilename());
m_TargetOutputDir = UnixFilename(tod.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
@@ -455,7 +458,10 @@
target = project->GetBuildTarget(project->GetActiveBuildTarget());
}
}
- if (project != m_LastProject || target != m_LastTarget || (editor && (editor->GetFilename() != m_ActiveEditorFilename)) )
+ if ( (project != m_LastProject) || (target != m_LastTarget) || (editor && (editor->GetFilename() != m_ActiveEditorFilename))
+ || (project && (UnixFilename(project->GetBasePath()) != m_ProjectDir))
+ || (project && (UnixFilename(project->GetFilename()) != m_ProjectFilename))
+ || (target && (target->GetTitle() != m_TargetName)) )
RecalcVars(project, editor, target);
wxString search;
--- End code ---
Oleg_Sam:
Thank you for this patch. Now its all work fine!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version