fix segfault in python scripting caused by new 3D code

The attached patch ensures the S3D_MASTER class does not cause
a segfault in pcbnew when used from Python scripting.

The issue is due to an "extern KIWAY* TheKiway" which was exposed
to allow S3D_MASTER to use the new resolver to handle 3D filenames.
Unfortunately TheKiway cannot be assigned a value until a window is
created which implements Kiway. The change introduced by this
patch should not alter the behavior of S3D_MASTER compared to
the behavior before the 3D merge.

The extern variable is only there to support S3D_MASTER which in
turn is there to support the current 3DViewer. In the planned software
structure the rather complex S3D_MASTER class is replaced with
a simple struct which only holds the model name and position/
orientation/scale data as stored in the PCB file; since the replacement
does not perform filename resolution there is no need to expose the
Kiway. For example in Mario's branch we removed the extern and
S3D_MASTER class many months ago.
This commit is contained in:
Cirilo Bernardo 2016-04-05 20:32:50 -04:00 committed by Chris Pavlina
parent 35e657806f
commit e1b308b3b1
1 changed files with 5 additions and 2 deletions

View File

@ -141,8 +141,11 @@ void S3D_MASTER::SetShape3DName( const wxString& aShapeName )
else
m_Shape3DFullFilename = m_Shape3DName;
m_Shape3DFullFilename = TheKiway->Prj().Get3DCacheManager()->GetResolver()
->ResolvePath( m_Shape3DFullFilename );
if( NULL != TheKiway )
{
m_Shape3DFullFilename = TheKiway->Prj().Get3DCacheManager()->GetResolver()
->ResolvePath( m_Shape3DFullFilename );
}
return;
}