Fixed a temporary memory reference problem

This commit is contained in:
Zane U. Ji 2012-08-09 20:40:32 +08:00
parent e60ce08f9b
commit 97b3ac3fc1
1 changed files with 5 additions and 26 deletions

View File

@ -5835,7 +5835,7 @@ void MyFrame::OnAssociate ( wxCommandEvent& event )
std::string utf8Buffer; std::string utf8Buffer;
getRawText ( doc, utf8Buffer ); getRawText ( doc, utf8Buffer );
std::auto_ptr<WrapExpat> wellformedparser ( new WrapExpat() ); std::auto_ptr<WrapExpat> wellformedparser ( new WrapExpat() );
if ( !wellformedparser->parse ( utf8Buffer ) ) if ( !wellformedparser->parse ( utf8Buffer ) ) // FIXME: Set encoding to UTF-8 before parsing.
{ {
std::string error = wellformedparser->getLastError(); std::string error = wellformedparser->getLastError();
wxString wideError = wxString ( error.c_str(), wxConvUTF8, error.size() ); wxString wideError = wxString ( error.c_str(), wxConvUTF8, error.size() );
@ -5944,36 +5944,15 @@ void MyFrame::openRememberedTabs()
{ {
if ( openTabsOnClose.empty() ) if ( openTabsOnClose.empty() )
return; return;
wchar_t *s, *it; wxArrayString v = wxSplit ( openTabsOnClose, _T ( '|' ) );
s = it = ( wchar_t * ) openTabsOnClose.wc_str();
std::vector<wxString> v;
wxString buffer = wxEmptyString;
for ( ; *it; it++ )
{
if ( *it == L'|' )
{
if ( !buffer.empty() )
{
v.push_back ( buffer );
}
buffer = wxEmptyString;
}
else
buffer += *it;
}
if ( !buffer.empty() )
{
v.push_back ( buffer );
}
if ( v.empty() ) if ( v.empty() )
return; return;
std::vector<wxString>::iterator vit; wxArrayString::iterator vit;
for ( vit = v.begin(); vit != v.end(); vit++ ) for ( vit = v.begin(); vit != v.end(); vit++ )
{ {
if ( !openFile ( *vit ) ) if ( vit->Empty() || !openFile ( *vit ) )
break; continue; //break; // Ignore errors
} }
XmlDoc *doc; XmlDoc *doc;
if ( ( doc = getActiveDocument() ) != NULL ) if ( ( doc = getActiveDocument() ) != NULL )