mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Fix crash on exit (addresses #607).
MutableVal's destructor now checks if the global scope still exists before trying to remove an identifier from it.
This commit is contained in:
parent
2d85ab9818
commit
a267c30fcd
2 changed files with 5 additions and 3 deletions
|
@ -219,5 +219,5 @@ Scope* current_scope()
|
||||||
|
|
||||||
Scope* global_scope()
|
Scope* global_scope()
|
||||||
{
|
{
|
||||||
return scopes[0];
|
return scopes.length() == 0 ? 0 : scopes[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,14 +638,16 @@ MutableVal::~MutableVal()
|
||||||
{
|
{
|
||||||
for ( list<ID*>::iterator i = aliases.begin(); i != aliases.end(); ++i )
|
for ( list<ID*>::iterator i = aliases.begin(); i != aliases.end(); ++i )
|
||||||
{
|
{
|
||||||
global_scope()->Remove((*i)->Name());
|
if ( global_scope() )
|
||||||
|
global_scope()->Remove((*i)->Name());
|
||||||
(*i)->ClearVal(); // just to make sure.
|
(*i)->ClearVal(); // just to make sure.
|
||||||
Unref((*i));
|
Unref((*i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( id )
|
if ( id )
|
||||||
{
|
{
|
||||||
global_scope()->Remove(id->Name());
|
if ( global_scope() )
|
||||||
|
global_scope()->Remove(id->Name());
|
||||||
id->ClearVal(); // just to make sure.
|
id->ClearVal(); // just to make sure.
|
||||||
Unref(id);
|
Unref(id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue