--Boundary-00=_wXJsHzQtMmoiqgd Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > Le Sunday 18 November 2007, Marcel Wiesweg a =E9crit : > > I have a bit more for you: > > For testing, I have added this call to the UI thread, before the worker > > thread starts. > > > > >From the worker thread, when the call is executed again, I then get > > > about 8 of > > > > these error messages: > > > > QObject: Cannot create children for a parent that is in a different > > thread. (Parent is Solid::Backends::Hal::HalDevice(0x83f4f88), parent's > > thread is QThread(0x82e33f8), current thread is > > Digikam::ScanController(0x83ddbc0) > > Once again, would you mind making a test case for this? The attached test case is an attempt to isolate the Solid code that was=20 causing the problem. The part is copied from digikam source without change.= =20 With this case, I can reproduce the "Cannot create children for a parent th= at=20 is in a different thread" problem; this is caused when the call is executed= =20 in two threads at the same time. If you exchange the two lines t.start() an= d=20 t.solid(), then it does not occur. I have not been able to reproduce the original few-seconds-lockup problem w= ith=20 this testcase though. I don't know what is needed to trigger this. In the meantime, I have worked around the problem by moving the actual Soli= d=20 call to the main thread with a blocking queued signal in digikam, so it's n= ot=20 causing trouble at the moment. > > I can't seem to reproduce your issues. > > Now just curious, why do you use a thread in the first place? If that's > only for a call to Device::list* that looks like overkill. It's a worker thread that initializes the database and scans the collection= =2E=20 To find out which parts of the collection are available, it needs to know t= he=20 hardware situation. The UI thread is displaying progress info in the time. Marcel > > Regards. --Boundary-00=_wXJsHzQtMmoiqgd Content-Type: text/x-c++src; charset="iso-8859-15"; name="testsolid.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="testsolid.cpp" #include #include #include #include #include "kapplication.h" #include #include #include #include #include #include #include #include #include class SolidVolumeInfo { public: QString path; // mount path of volume, with trailing slash QString uuid; // UUID as from Solid QString label; // volume label (think of CDs) bool isRemovable; // may be removed bool isOpticalDisc; bool isNull() const { return path.isNull(); } }; class Thread : public QThread { public: Thread() { } void run() { solid(); } void solid() { QList volumes; qDebug() << "Starting list operation"; QList devices = Solid::Device::listFromType(Solid::DeviceInterface::StorageAccess); qDebug() << "got listFromType" << endl; foreach(Solid::Device accessDevice, devices) { // check for StorageAccess if (!accessDevice.is()) continue; Solid::StorageAccess *access = accessDevice.as(); if (!access->isAccessible()) continue; // check for StorageDrive Solid::Device driveDevice; for (Solid::Device currentDevice = accessDevice; currentDevice.isValid(); currentDevice = currentDevice.parent()) { if (currentDevice.is()) { driveDevice = currentDevice; break; } } if (!driveDevice.isValid()) continue; Solid::StorageDrive *drive = driveDevice.as(); // check for StorageVolume Solid::Device volumeDevice; for (Solid::Device currentDevice = accessDevice; currentDevice.isValid(); currentDevice = currentDevice.parent()) { if (currentDevice.is()) { volumeDevice = currentDevice; break; } } if (!volumeDevice.isValid()) continue; Solid::StorageVolume *volume = volumeDevice.as(); SolidVolumeInfo info; info.path = access->filePath(); if (!info.path.endsWith("/")) info.path += "/"; info.uuid = volume->uuid(); info.label = volume->label(); info.isRemovable = drive->isRemovable(); info.isOpticalDisc = volumeDevice.is(); volumes << info; } } }; int main(int argc, char **argv) { QApplication app(argc, argv); Thread t; t.start(); t.solid(); QEventLoop l; l.exec(); } --Boundary-00=_wXJsHzQtMmoiqgd Content-Type: text/plain; charset="iso-8859-15"; name="CMakeLists.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CMakeLists.txt" PROJECT(testsolid) FIND_PACKAGE(KDE4 REQUIRED) INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} ) SET(KDE4ProjectSources testsolid.cpp ) KDE4_ADD_EXECUTABLE(testsolid ${KDE4ProjectSources} ) TARGET_LINK_LIBRARIES(testsolid ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ) --Boundary-00=_wXJsHzQtMmoiqgd Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kde-hardware-devel mailing list Kde-hardware-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-hardware-devel --Boundary-00=_wXJsHzQtMmoiqgd--