router: LOGGER now stores UUIDs, not pointers to BOARD_ITEMs.
Caused occasional crashes when saving the debug event log, as some of the BOARD_ITEMS could have been deleted before SaveLog call.
This commit is contained in:
parent
e5e588ebba
commit
3e98c44636
|
@ -53,11 +53,7 @@ void LOGGER::Save( const std::string& aFilename )
|
||||||
{
|
{
|
||||||
uint64_t id = 0;
|
uint64_t id = 0;
|
||||||
|
|
||||||
if( evt.item && evt.item->Parent() )
|
fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y, (const char *) evt.uuid );
|
||||||
{
|
|
||||||
const char* idString = evt.item->Parent()->m_Uuid.AsString().c_str();
|
|
||||||
fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y, idString );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
@ -70,10 +66,13 @@ void LOGGER::Log( LOGGER::EVENT_TYPE evt, VECTOR2I pos, const ITEM* item )
|
||||||
|
|
||||||
ent.type = evt;
|
ent.type = evt;
|
||||||
ent.p = pos;
|
ent.p = pos;
|
||||||
ent.item = item;
|
ent.uuid = "null";
|
||||||
|
|
||||||
|
|
||||||
|
if( item && item->Parent() )
|
||||||
|
ent.uuid = item->Parent()->m_Uuid.AsString();
|
||||||
|
|
||||||
m_events.push_back( ent );
|
m_events.push_back( ent );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
struct EVENT_ENTRY {
|
struct EVENT_ENTRY {
|
||||||
VECTOR2I p;
|
VECTOR2I p;
|
||||||
EVENT_TYPE type;
|
EVENT_TYPE type;
|
||||||
const ITEM* item;
|
wxString uuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
LOGGER();
|
LOGGER();
|
||||||
|
|
|
@ -531,12 +531,8 @@ void ROUTER_TOOL::saveRouterDebugLog()
|
||||||
|
|
||||||
for( auto evt : events)
|
for( auto evt : events)
|
||||||
{
|
{
|
||||||
wxString id = "null";
|
|
||||||
if( evt.item && evt.item->Parent() )
|
|
||||||
id = evt.item->Parent()->m_Uuid.AsString();
|
|
||||||
|
|
||||||
fprintf( f, "event %d %d %d %s\n", evt.p.x, evt.p.y, evt.type,
|
fprintf( f, "event %d %d %d %s\n", evt.p.x, evt.p.y, evt.type,
|
||||||
(const char*) id.c_str() );
|
(const char*) evt.uuid );
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
|
Loading…
Reference in New Issue