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

QQuickLoader crashes if source component is garbage collected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.2.1
    • 5.2.0 Beta1 , 5.2.0 RC1
    • None
    • Kubuntu 13.10
    • adaedcb9ead1c536ff3d8fba0fb9f4fc262d4d45

    Description

      I assume that you have built Qt from stable branch, commit dbac1e77f79ff99945cea41522f535132cacc692 and load project below in QtCreator.

      minimal reproduce example.

      Steps to reproduce:
      1) Open file qt5/qtdeclarative/src/quick/items/qquickloader.cpp, and place break at line 474 (should be "d->component = comp;")

      2) Run programme

      3) gdb should stop execution on break, press F5 until you see that value of comp -> [QObject] -> d_ptr -> url ends with "GeneralSettings.qml":

      	Locals		
      		comp	@0xf7f8c0	QQmlComponent
      			[QObject]		QObject
      				<skipped>
      				d_ptr	@0xf76ed0	QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>
      					[QObjectPrivate]		QObjectPrivate
      					<skipped>
      					url	"file:///home/Void/mydevel/EventManager/playground/qml_crash_reproduce/ShortcutSettings.qml"	QUrl
      				parent	0x0	QObject *
      				<skipped>
      			<skipped>
      	<skipped>
      

      4) Remember address of "comp", in my case it is @0xf7f8c0

      5) Open pane in QtCreator to issue commands to gdb: Window -> Views -> Debugger Log

      6) Set this breakpoint via "Command:" LineEdit in opened pane
      b QObject::deleteLater if this==0xf7f8c0
      where 0xf7f8c0 - is YOUR address from previous step

      7) Now disable break on line 474 ("d->component = comp;"), and run programme (press F5)

      8) You should see window of main app, so press Ctrl+O (of press Tools -> Options) (just in case: if gdb did not stop execution after this, try to open second tab), at this point gdb should stop at break, which is placed at QObject::deleteLater!
      As you can see comp with given address is really being deleted.

      9) Now, if you still in doubt,
      a) set break in file qt5/qtdeclarative/src/quick/items/qquickloader.cpp at line 596 (should be "if (!q->isComponentComplete() || !component)"),
      b) press F5, main windown of the app should became available
      c) and open second tab ("Settings 2")
      and ensure that QQuickLoaderPrivate still tries to use deleted object
      (as you can see on screenshot, address of component is @0xf7f8c0!)

      This bug was introduced between
      Wed Sep 11 4072c25a70acaa11e7831848c327be7886ef473e and
      Sat Aug 31 770893c71b179aa87c1bf2d83318ba62c8c2aa96

      Attachments

        1. qtbug35334_1.zip
          4 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            dimanne DimanNe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes