Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/script/bridge/qscriptqobject.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    979979    Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject));
    980980    QObject *qobj = static_cast<QScript::QObjectDelegate*>(delegate)->value();
    981     Q_ASSERT_X(qobj != 0, "QtFunction::call", "handle the case when QObject has been deleted");
     981    if (!qobj)
     982        return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("cannot call function of deleted QObject"));
    982983    QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
    983984
     
    22202221
    22212222    if (exec->hadException()) {
    2222         engine->emitSignalHandlerException();
     2223        if (slot.inherits(&QtFunction::info) && !static_cast<QtFunction*>(JSC::asObject(slot))->qobject()) {
     2224            // The function threw an error because the target QObject has been deleted.
     2225            // The connections list is stale; remove the signal handler and ignore the exception.
     2226            removeSignalHandler(sender(), signalIndex, receiver, slot);
     2227            exec->clearException();
     2228        } else {
     2229            engine->emitSignalHandlerException();
     2230        }
    22232231    }
    22242232}
Note: See TracChangeset for help on using the changeset viewer.