Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7313

Uncaught Exception: cannot call function of deleted QObject

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.2
    • 4.5.1
    • Qt Script
    • None
    • ed5fed36f38b9de0452cc427db679266d249f216

    Description

      function getWindow() {
          window = qwidget(1280,1024);
          object.transactionCompleted.connect(window, "deleteLater");
          return window;
      }
      

      The first time object.transactionCompleted is emitted, I don't get an error.
      The second time object.transactionCompleted is emitted, I get an uncaught exception:

              Error: cannot call function of deleted QObject
      	<anonymous>(QVariant(Enzo::Pay::TransactionResult))@:-1
      	<global>()@:-
      

      The qwidget function is implemented like this:

      QScriptValue qwidgetMaker(QScriptContext *context, QScriptEngine *engine) {
          QWidget *w = new QWidget(NULL);
          w->resize( context->argument(0).toInt32(), context->argument(1).toInt32() );
          QScriptValue v = engine->newQObject(w, QScriptEngine::ScriptOwnership);
          v.setProperty("winId", engine->newVariant(QVariant::fromValue((WId)w->winId())));
          return v;
      }
      

      So, the problem is that QScript is not automatically removing the connections of objects that have been deleted. I would expect this to work because it works with C++ objects.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kenthans Kent Hansen (Inactive)
            ryan@enzosystems.com Ryan van der Bijl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes