Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
1.3.0
-
None
-
Ubuntu 12.04.2 LTS
Qt 5.0.2 built static (to build "installerfw" )
-
8b3ff163a8b8b67cb22c9548cdcd9b72735ac211
Description
The documentation needs to explain why it could be a bad idea to have QObjects members initialized outside from the performOperation method.
Example of user confusion in using a QObject member(here QProcess):
I am trying to implement an operation to the installer similar to one already implemented - "Execute"
The purpose of my modified operation is to allow the process to receive stdin with a process.write().I followed the following instructions to register my custom operations, but it is not executing properly:
1- in kdupdateoperations.cpp and kdupdateoperations.h I copied and pasted the same content as the execute
operation, but changed the name to "ExecutewStdin"2- I registered this new operation on kdupdateoperationfactory.cpp as:
registerUpdateOperation<ExecutewStdin>(QLatin1String("ExecutewStdin"));For basic testing purposes, I wanted to leave it like this to check if I can access my Operation from the
xml file. I'm calling my operation like this:component.addOperation("ExecutewStdin", "touch" , "test_file");I get the following error:
geperezg@GEPEREZG-LINUX-01:~/Qt/inst/build-installerfw-Static_Qt_5_0_2_GCC_64bit-Debug/examples/tutorial$ ./stdin_inst Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x2fe4b70), parent's thread is QThread(0x2d92eb0), current thread is QThread(0x2fe9550) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x2fe4b70), parent's thread is QThread(0x2d92eb0), current thread is QThread(0x2fe9550) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x2fe4b70), parent's thread is QThread(0x2d92eb0), current thread is QThread(0x2fe9550) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x2fe4b70), parent's thread is QThread(0x2d92eb0), current thread is QThread(0x2fe9550) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x2fe4b70), parent's thread is QThread(0x2d92eb0), current thread is QThread(0x2fe9550) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QSocketNotifier: socket notifiers cannot be disabled from another thread (kernel/qeventdispatcher_unix.cpp:460, virtual void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier*)) Warning: QSocketNotifier: socket notifiers cannot be disabled from another thread (kernel/qeventdispatcher_unix.cpp:460, virtual void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier*)) Warning: QSocketNotifier: Invalid socket 28 and type 'Read', disabling... (kernel/qeventdispatcher_unix.cpp:235, int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags, timeval*)) Warning: QSocketNotifier: Invalid socket 26 and type 'Read', disabling... (kernel/qeventdispatcher_unix.cpp:235, int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags, timeval*)) Warning: QSocketNotifier: socket notifiers cannot be disabled from another thread (kernel/qeventdispatcher_unix.cpp:460, virtual void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier*)) Segmentation fault (core dumped) **When running in gdb , and then issuing "backtrace" this is what I get:
geperezg@GEPEREZG-LINUX-01:~/Qt/inst/build-installerfw-Static_Qt_5_0_2_GCC_64bit-Debug/examples/tutorial$ gdb ./stdin_inst GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... Reading symbols from /home/geperezg/Qt/inst/build-installerfw-Static_Qt_5_0_2_GCC_64bit-Debug/examples/tutorial/stdin_inst...done. (gdb) run Starting program: /home/geperezg/Qt/inst/build-installerfw-Static_Qt_5_0_2_GCC_64bit-Debug/examples/tutorial/stdin_inst [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff391e700 (LWP 589)] Qt: gdb: -nograb added to command-line options. Use the -dograb option to enforce grabbing. [New Thread 0x7ffff2cf5700 (LWP 590)] [New Thread 0x7ffff127f700 (LWP 591)] [Thread 0x7ffff127f700 (LWP 591) exited] [New Thread 0x7ffff127f700 (LWP 594)] [New Thread 0x7ffff0a7e700 (LWP 595)] [New Thread 0x7fff69a9b700 (LWP 596)] Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x1faa690), parent's thread is QThread(0x1d57f60), current thread is QThread(0x1dd91a0) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x1faa690), parent's thread is QThread(0x1d57f60), current thread is QThread(0x1dd91a0) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x1faa690), parent's thread is QThread(0x1d57f60), current thread is QThread(0x1dd91a0) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x1faa690), parent's thread is QThread(0x1d57f60), current thread is QThread(0x1dd91a0) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QProcess(0x1faa690), parent's thread is QThread(0x1d57f60), current thread is QThread(0x1dd91a0) (kernel/qobject.cpp:647, bool check_parent_thread(QObject*, QThreadData*, QThreadData*)) Warning: QSocketNotifier: socket notifiers cannot be disabled from another thread (kernel/qeventdispatcher_unix.cpp:460, virtual void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier*)) Warning: QSocketNotifier: socket notifiers cannot be disabled from another thread (kernel/qeventdispatcher_unix.cpp:460, virtual void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier*)) Warning: QSocketNotifier: Invalid socket 32 and type 'Read', disabling... (kernel/qeventdispatcher_unix.cpp:235, int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags, timeval*)) Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff127f700 (LWP 594)] 0x000000000124ddfc in QSocketNotifier::setEnabled (this=0x7fff60001570, enable=false) at kernel/qsocketnotifier.cpp:276 276 if (!d->threadData->eventDispatcher) // perhaps application/thread is shutting down (gdb) backtrace #0 0x000000000124ddfc in QSocketNotifier::setEnabled (this=0x7fff60001570, enable=false) at kernel/qsocketnotifier.cpp:276 #1 0x000000000126c80a in QEventDispatcherUNIXPrivate::doSelect (this=0x7fff600008c0, flags=..., timeout=0x0) at kernel/qeventdispatcher_unix.cpp:237 #2 0x000000000126e0b5 in QEventDispatcherUNIX::processEvents (this=0x7fff60001890, flags=...) at kernel/qeventdispatcher_unix.cpp:599 #3 0x0000000001210bb5 in QEventLoop::processEvents (this=0x7ffff127ec50, flags=...) at kernel/qeventloop.cpp:136 #4 0x0000000001210e7f in QEventLoop::exec (this=0x7ffff127ec50, flags=...) at kernel/qeventloop.cpp:212 #5 0x000000000053ca82 in KDUpdater::ExecutewStdin::performOperation (this=0x1faa640) at ../../../../installer-framework/src/libs/kdtools/kdupdaterupdateoperations.cpp:1132 #6 0x0000000000468352 in QInstaller::runOperation (operation=0x1faa650, type=QInstaller::PackageManagerCorePrivate::Perform) at ../../../../installer-framework/src/libs/installer/packagemanagercore_p.cpp:121 #7 0x0000000000485e62 in QtConcurrent::StoredFunctorCall2<bool, bool (*)(KDUpdater::UpdateOperation*, QInstaller::PackageManagerCorePrivate::OperationType), KDUpdater::UpdateOperation*, QInstaller::PackageManagerCorePrivate::OperationType>::runFunctor (this=0x1fb5e20) at ../../../../../qt-everywhere-opensource-src-5.0.2/qtbase/include/QtConcurrent/../../src/concurrent/qtconcurrentstoredfunctioncall.h:469 #8 0x0000000000467ef0 in QtConcurrent::RunFunctionTask<bool>::run (this=0x1fb5e20) at ../../../../../qt-everywhere-opensource-src-5.0.2/qtbase/include/QtConcurrent/../../src/concurrent/qtconcurrentrunbase.h:105 #9 0x00000000010d87b5 in QThreadPoolThread::run (this=0x1dd91a0) at thread/qthreadpool.cpp:100 #10 0x00000000010de5d5 in QThreadPrivate::start (arg=0x1dd91a0) at thread/qthread_unix.cpp:333 ---Type <return> to continue, or q <return> to quit---q Quit (gdb) quit A debugging session is active. Inferior 1 [process 586] will be killed. Quit anyway? (y or n) Please answer y or n. A debugging session is active. Inferior 1 [process 586] will be killed.As i said in the beginning, my operation is identical to execute. One more thing, the touch command does seem to work as the
file "test_file" is created, but it doesn't finish and/or produce all other files that are produced under a successful installation.
I'm including the files I modified for your reference.
I'm building the installer framework project with a static version of Qt I built before. It doesn't
give me any trouble when running the standard operations/instructions.
For completeness, I'm also including the package.xml and installation script used to build the installer. Installer is built with following cmd line:
../../bin/binarycreator -p packages/ -c config/config.xml --offline-only stdin_inst
Keeping the installer simple just to test the custom operation....Thanks in advance for your help,
Gabriel