Commit aa541fcb authored by charras's avatar charras

fixed: bug 2602865 (change module crashes pcbnew)

parent c0b31f92
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -327,7 +327,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) ...@@ -327,7 +327,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
*/ */
{ {
wxString msg; wxString msg;
MODULE* PtModule, * PtBack; MODULE* Module, * PtBack;
bool change = FALSE; bool change = FALSE;
wxString newmodulename = m_NewModule->GetValue(); wxString newmodulename = m_NewModule->GetValue();
wxString value, lib_reference; // pour memo Reflib et value de reference wxString value, lib_reference; // pour memo Reflib et value de reference
...@@ -362,26 +362,26 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) ...@@ -362,26 +362,26 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
* Change_1_Module() modifie le dernier module de la liste * Change_1_Module() modifie le dernier module de la liste
*/ */
PtModule = m_Parent->GetBoard()->m_Modules; Module = m_Parent->GetBoard()->m_Modules;
for( ; PtModule != NULL; PtModule = PtModule->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( PtModule->Next() == NULL ) if( Module->Next() == NULL )
break; break;
} }
/* Ici PtModule pointe le dernier module de la liste */ /* Ici Module pointe le dernier module de la liste */
for( ; (BOARD*) PtModule != m_Parent->GetBoard(); PtModule = PtBack ) for( ; Module && ((BOARD*) Module != m_Parent->GetBoard()); Module = PtBack )
{ {
MODULE* module; MODULE* module;
PtBack = PtModule->Back(); PtBack = Module->Back();
if( lib_reference.CmpNoCase( PtModule->m_LibRef ) != 0 ) if( lib_reference.CmpNoCase( Module->m_LibRef ) != 0 )
continue; continue;
if( check_module_value ) if( check_module_value )
{ {
if( value.CmpNoCase( PtModule->m_Value->m_Text ) != 0 ) if( value.CmpNoCase( Module->m_Value->m_Text ) != 0 )
continue; continue;
} }
module = Change_1_Module( PtModule, newmodulename.GetData(), ShowErr ); module = Change_1_Module( Module, newmodulename.GetData(), ShowErr );
if( module ) if( module )
change = TRUE; change = TRUE;
else if( ShowErr ) else if( ShowErr )
...@@ -408,7 +408,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) ...@@ -408,7 +408,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
* - memes netnames pour pads de meme nom * - memes netnames pour pads de meme nom
*/ */
{ {
MODULE* PtModule, * PtBack; MODULE * Module, * PtBack;
bool change = FALSE; bool change = FALSE;
int ShowErr = 5; // Affiche 5 messages d'err maxi int ShowErr = 5; // Affiche 5 messages d'err maxi
...@@ -422,18 +422,18 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) ...@@ -422,18 +422,18 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
* Change_1_Module() modifie le dernier module de la liste * Change_1_Module() modifie le dernier module de la liste
*/ */
PtModule = m_Parent->GetBoard()->m_Modules; Module = m_Parent->GetBoard()->m_Modules;
for( ; PtModule != NULL; PtModule = PtModule->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( PtModule->Next() == NULL ) if( Module->Next() == NULL )
break; break;
} }
/* Ici PtModule pointe le dernier module de la liste */ /* Ici Module pointe le dernier module de la liste */
for( ; (BOARD*) PtModule != m_Parent->GetBoard(); PtModule = PtBack ) for( ; Module && ((BOARD*) Module != m_Parent->GetBoard()); Module = PtBack )
{ {
PtBack = PtModule->Back(); PtBack = Module->Back();
if( Change_1_Module( PtModule, PtModule->m_LibRef.GetData(), ShowErr ) ) if( Change_1_Module( Module, Module->m_LibRef.GetData(), ShowErr ) )
change = TRUE; change = TRUE;
else if( ShowErr ) else if( ShowErr )
ShowErr--; ShowErr--;
...@@ -448,7 +448,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) ...@@ -448,7 +448,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
/******************************************************************/ /******************************************************************/
MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* PtModule, MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* Module,
const wxString& new_module, bool ShowError ) const wxString& new_module, bool ShowError )
/*******************************************************************/ /*******************************************************************/
...@@ -467,18 +467,18 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* PtModule, ...@@ -467,18 +467,18 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* PtModule,
MODULE* NewModule; MODULE* NewModule;
wxString Line; wxString Line;
if( PtModule == NULL ) if( Module == NULL )
return NULL; return NULL;
wxBusyCursor dummy; wxBusyCursor dummy;
/* Memorisation des parametres utiles de l'ancien module */ /* Memorisation des parametres utiles de l'ancien module */
oldnamecmp = PtModule->m_LibRef; oldnamecmp = Module->m_LibRef;
namecmp = new_module; namecmp = new_module;
/* Chargement du module */ /* Chargement du module */
Line.Printf( _( "Change module %s (%s) " ), Line.Printf( _( "Change module %s (%s) " ),
PtModule->m_Reference->m_Text.GetData(), oldnamecmp.GetData() ); Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() );
m_WinMsg->WriteText( Line ); m_WinMsg->WriteText( Line );
namecmp.Trim( TRUE ); namecmp.Trim( TRUE );
...@@ -490,14 +490,14 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* PtModule, ...@@ -490,14 +490,14 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* PtModule,
return NULL; return NULL;
} }
if( PtModule == m_CurrentModule ) if( Module == m_CurrentModule )
m_CurrentModule = NewModule; m_CurrentModule = NewModule;
m_WinMsg->WriteText( wxT( "Ok\n" ) ); m_WinMsg->WriteText( wxT( "Ok\n" ) );
/* Effacement a l'ecran de l'ancien module */ /* Effacement a l'ecran de l'ancien module */
PtModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); Module->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
m_Parent->Exchange_Module( this, PtModule, NewModule ); m_Parent->Exchange_Module( this, Module, NewModule );
/* Affichage du nouveau module */ /* Affichage du nouveau module */
NewModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); NewModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment