diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index c444ba707a..4eac923d9d 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -239,7 +239,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in { SetScreen( nullptr ); delete g_RootSheet; - g_RootSheet = NULL; + if( g_CurrentSheet ) + g_CurrentSheet->clear(); + g_RootSheet = nullptr; CreateScreens(); } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 74ba405175..4d23529c01 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -489,12 +489,18 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount() SCH_SCREEN* SCH_EDIT_FRAME::GetScreen() const { + if( !g_CurrentSheet ) + return nullptr; + return g_CurrentSheet->LastScreen(); } wxString SCH_EDIT_FRAME::GetScreenDesc() const { + if(! g_CurrentSheet ) + return wxT(""); + wxString s = g_CurrentSheet->PathHumanReadable(); return s; @@ -748,8 +754,12 @@ void SCH_EDIT_FRAME::OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent ) void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent ) { - aEvent.Enable( GetScreen()->IsModify() ); + auto screen = GetScreen(); + if( !screen ) + return; + + aEvent.Enable( screen->IsModify() ); } diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index b6904c395c..863c0bcc7a 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -125,9 +125,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) }; KIGFX::VIEW_CONTROLS* controls = getViewControls(); - controls->SetSnapping( true ); VECTOR2I originalCursorPos = controls->GetCursorPosition(); + bool moveMode; // Be sure that there is at least one item that we can move. If there's no selection try // looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection). @@ -463,7 +463,6 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi switch( test->Type() ) { - default: case SCH_LINE_T: { // Select the connected end of wires/bus connections.