Ejemplo n.º 1
0
bool KJSDebugWin::sourceUnused(KJS::ExecState *exec, int sourceId)
{
    // Verify that there aren't any contexts on the stack using the given sourceId
    // This should never be the case because this function is only called when
    // the interpreter has deleted all Node objects for the source.
    for(int e = 0; e < m_execsCount; e++)
        assert(m_execs[e]->context().sourceId() != sourceId);

    // Now remove the fragment (and the SourceFile, if it was the last fragment in that file)
    SourceFragment *fragment = m_sourceFragments[sourceId];
    if(fragment)
    {
        m_sourceFragments.erase(sourceId);

        SourceFile *sourceFile = fragment->sourceFile;
        if(sourceFile->hasOneRef())
        {
            for(int i = 0; i < m_sourceSel->count(); i++)
            {
                if(m_sourceSelFiles.at(i) == sourceFile)
                {
                    m_sourceSel->removeItem(i);
                    m_sourceSelFiles.remove(i);
                    break;
                }
            }
            removeSourceFile(exec->interpreter(), sourceFile->url);
        }
        delete fragment;
    }

    return (m_mode != Stop);
}