From c146cc09eba5aebb4ee06b96ccc825d487e8b317 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 8 Apr 2016 14:11:05 +0200 Subject: [PATCH] Kicad: fix a crash when changing a project, if pcbnew was run and "Update PCB from Schematic" was run and Schematic editor never opened. (In this case the schematic frame exists, but some members are not initialized as expected, and a crash happens when calling the schematic editor dtor) Minor other fix: avoid multiple very similar strings to translate in 3d_filename_resolver.cpp --- 3d-viewer/3d_cache/3d_filename_resolver.cpp | 9 ++++----- common/draw_frame.cpp | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/3d-viewer/3d_cache/3d_filename_resolver.cpp b/3d-viewer/3d_cache/3d_filename_resolver.cpp index 20d224b26f..bbc4274df8 100644 --- a/3d-viewer/3d_cache/3d_filename_resolver.cpp +++ b/3d-viewer/3d_cache/3d_filename_resolver.cpp @@ -559,7 +559,7 @@ bool S3D_FILENAME_RESOLVER::readPathList( void ) { std::ostringstream ostr; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - wxString errmsg = _( "could not open configuration file" ); + wxString errmsg = _( "Could not open configuration file" ); ostr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'"; wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() ); return false; @@ -678,11 +678,10 @@ bool S3D_FILENAME_RESOLVER::writePathList( void ) { std::ostringstream ostr; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - wxString errmsg = _( "could not open configuration file " ); + wxString errmsg = _( "Could not open configuration file" ); ostr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'"; wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() ); - wxMessageBox( _( "Could not open configuration file" ), - _( "Write 3D search path list" ) ); + wxMessageBox( errmsg, _( "Write 3D search path list" ) ); return false; } @@ -923,7 +922,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString& { std::ostringstream ostr; ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n"; - wxString errmsg = _( "missing closing quote mark in config file" ); + wxString errmsg = "missing closing quote mark in config file"; ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'"; wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() ); diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 9447aff9e2..99ca672fda 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -691,7 +691,9 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() ); aCfg->Write( baseCfgName + GridColorEntryKeyword, ( long ) GetGridColor() ); aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId ); - aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) ); + + if( GetScreen() ) + aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) ); }