Fix crash when exporting vrml (see bug Bug #1502549) when there is a Glu error.

Enhancement: dialog_footprint_wizard_list remembers now its size.
This commit is contained in:
jean-pierre charras 2015-10-04 13:46:56 +02:00
parent 2930506f03
commit 19124ceee8
6 changed files with 42 additions and 21 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -150,15 +150,11 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
// Connect Events
m_filePicker->Connect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnFileChanged ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnOkClick ), NULL, this );
}
DIALOG_EXPORT_3DFILE_BASE::~DIALOG_EXPORT_3DFILE_BASE()
{
// Disconnect Events
m_filePicker->Disconnect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnFileChanged ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnOkClick ), NULL, this );
}

View File

@ -1662,11 +1662,11 @@
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkClick</event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -69,8 +69,6 @@ class DIALOG_EXPORT_3DFILE_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnFileChanged( wxFileDirPickerEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -30,24 +30,26 @@
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <kiface_i.h>
#include <dialog_footprint_wizard_list.h>
#include <class_footprint_wizard.h>
#define ROW_NAME 0
#define ROW_DESCR 1
#define FPWIZARTDLIST_HEIGHT_KEY wxT( "FpWizardListHeight" )
#define FPWIZARTDLIST_WIDTH_KEY wxT( "FpWizardListWidth" )
DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
: DIALOG_FOOTPRINT_WIZARD_LIST_BASE( aParent )
{
int n_wizards = FOOTPRINT_WIZARDS::GetWizardsCount();
m_config = Kiface().KifaceSettings();
// Current wizard selection, empty or first
m_FootprintWizard = NULL;
m_footprintWizard = NULL;
if( n_wizards )
m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard( 0 );
m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( 0 );
// Choose selection mode and insert the needed rows
@ -71,20 +73,38 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
m_footprintWizardsGrid->ClearSelection();
m_footprintWizardsGrid->SelectRow( 0, false );
GetSizer()->SetSizeHints( this );
if( m_config )
{
wxSize size;
m_config->Read( FPWIZARTDLIST_WIDTH_KEY, &size.x, -1 );
m_config->Read( FPWIZARTDLIST_HEIGHT_KEY, &size.y, -1 );
SetSize( size );
}
Center();
}
DIALOG_FOOTPRINT_WIZARD_LIST::~DIALOG_FOOTPRINT_WIZARD_LIST()
{
if( m_config && !IsIconized() )
{
m_config->Write( FPWIZARTDLIST_WIDTH_KEY, GetSize().x );
m_config->Write( FPWIZARTDLIST_HEIGHT_KEY, GetSize().y );
}
}
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellWizardClick( wxGridEvent& event )
{
int click_row = event.GetRow();
m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard( click_row );
m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( click_row );
m_footprintWizardsGrid->SelectRow( event.GetRow(), false );
}
FOOTPRINT_WIZARD* DIALOG_FOOTPRINT_WIZARD_LIST::GetWizard()
{
return m_FootprintWizard;
return m_footprintWizard;
}

View File

@ -31,10 +31,12 @@
class DIALOG_FOOTPRINT_WIZARD_LIST: public DIALOG_FOOTPRINT_WIZARD_LIST_BASE
{
private:
FOOTPRINT_WIZARD *m_FootprintWizard;
FOOTPRINT_WIZARD* m_footprintWizard; ///< The selected python script wizard
wxConfigBase* m_config;
public:
DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow * parent );
DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow * aParent );
~DIALOG_FOOTPRINT_WIZARD_LIST();
FOOTPRINT_WIZARD* GetWizard();

View File

@ -1499,8 +1499,13 @@ void VRML_LAYER::glEnd( void )
// set the error message
void VRML_LAYER::SetGLError( GLenum errorID )
{
error = "";
error = (const char*)gluGetString( errorID );
const char * msg = (const char*)gluErrorString( errorID );
// If errorID is an illegal id, gluErrorString returns NULL
if( msg )
error = msg;
else
error.clear();
if( error.empty() )
{