Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/script/api/qscriptprogram.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    3333
    3434/*!
    35   \internal
    36 
    37   \since 4.6
     35  \since 4.7
    3836  \class QScriptProgram
    3937
     
    6462QScriptProgramPrivate::~QScriptProgramPrivate()
    6563{
    66     delete _executable;
     64    if (engine) {
     65        QScript::APIShim shim(engine);
     66        _executable.clear();
     67        engine->unregisterScriptProgram(this);
     68    }
    6769}
    6870
     
    7779    if (_executable) {
    7880        if (eng == engine)
    79             return _executable;
    80         delete _executable;
     81            return _executable.get();
     82        // "Migrating" to another engine; clean up old state
     83        QScript::APIShim shim(engine);
     84        _executable.clear();
     85        engine->unregisterScriptProgram(this);
    8186    }
    8287    WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
     
    8489    sourceId = provider->asID();
    8590    JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null.
    86     _executable = new JSC::EvalExecutable(exec, source);
     91    _executable = JSC::EvalExecutable::create(exec, source);
    8792    engine = eng;
     93    engine->registerScriptProgram(this);
    8894    isCompiled = false;
    89     return _executable;
     95    return _executable.get();
     96}
     97
     98void QScriptProgramPrivate::detachFromEngine()
     99{
     100    _executable.clear();
     101    sourceId = -1;
     102    isCompiled = false;
     103    engine = 0;
    90104}
    91105
     
    122136QScriptProgram::~QScriptProgram()
    123137{
    124     Q_D(QScriptProgram);
    125     //    if (d->engine && (d->ref == 1))
    126     //      d->engine->unregisterScriptProgram(d);
    127138}
    128139
     
    132143QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other)
    133144{
    134   //    if (d_func() && d_func()->engine && (d_func()->ref == 1))
    135       //        d_func()->engine->unregisterScriptProgram(d_func());
    136   //    }
    137145    d_ptr = other.d_ptr;
    138146    return *this;
Note: See TracChangeset for help on using the changeset viewer.