page layout editor: fix a crash on block move.

This crash was due to a pointer initialized to a temporary reference.
Very minor coding style fixes
This commit is contained in:
jean-pierre charras 2018-03-10 10:25:07 +01:00
parent 83d5a770e8
commit 2230abde1b
2 changed files with 13 additions and 12 deletions

View File

@ -177,7 +177,8 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
break; break;
case 'Z': case 'Z':
msg += *m_paperFormat; if( m_paperFormat )
msg += *m_paperFormat;
break; break;
case 'S': case 'S':
@ -196,11 +197,12 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
break; break;
case 'L': case 'L':
msg += *m_sheetLayer; if( m_sheetLayer )
msg += *m_sheetLayer;
break; break;
case 'P': case 'P':
msg += *m_sheetFullName; msg += m_sheetFullName;
break; break;
case 'Y': case 'Y':

View File

@ -388,7 +388,7 @@ protected:
const TITLE_BLOCK* m_titleBlock; // for basic inscriptions const TITLE_BLOCK* m_titleBlock; // for basic inscriptions
const wxString* m_paperFormat; // for basic inscriptions const wxString* m_paperFormat; // for basic inscriptions
wxString m_fileName; // for basic inscriptions wxString m_fileName; // for basic inscriptions
const wxString* m_sheetFullName; // for basic inscriptions wxString m_sheetFullName; // for basic inscriptions
const wxString* m_sheetLayer; // for basic inscriptions const wxString* m_sheetLayer; // for basic inscriptions
@ -400,10 +400,9 @@ public:
m_penSize = 1; m_penSize = 1;
m_sheetNumber = 1; m_sheetNumber = 1;
m_sheetCount = 1; m_sheetCount = 1;
m_sheetLayer = 0; m_sheetLayer = nullptr;
m_titleBlock = NULL; m_titleBlock = nullptr;
m_paperFormat = NULL; m_paperFormat = nullptr;
m_sheetFullName = NULL;
} }
~WS_DRAW_ITEM_LIST() ~WS_DRAW_ITEM_LIST()
@ -416,7 +415,7 @@ public:
* Set the filename to draw/plot * Set the filename to draw/plot
* @param aFileName = the text to display by the "filename" format * @param aFileName = the text to display by the "filename" format
*/ */
void SetFileName( const wxString & aFileName ) void SetFileName( const wxString& aFileName )
{ {
m_fileName = aFileName; m_fileName = aFileName;
} }
@ -425,16 +424,16 @@ public:
* Set the sheet name to draw/plot * Set the sheet name to draw/plot
* @param aSheetName = the text to draw/plot by the "sheetname" format * @param aSheetName = the text to draw/plot by the "sheetname" format
*/ */
void SetSheetName( const wxString & aSheetName ) void SetSheetName( const wxString& aSheetName )
{ {
m_sheetFullName = &aSheetName; m_sheetFullName = aSheetName;
} }
/** /**
* Set the sheet layer to draw/plot * Set the sheet layer to draw/plot
* @param aSheetLayer = the text to draw/plot by the "sheetlayer" format * @param aSheetLayer = the text to draw/plot by the "sheetlayer" format
*/ */
void SetSheetLayer( const wxString & aSheetLayer ) void SetSheetLayer( const wxString& aSheetLayer )
{ {
m_sheetLayer = &aSheetLayer; m_sheetLayer = &aSheetLayer;
} }