[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/phonon/platform_kde
From:       Matthias Kretz <kretz () kde ! org>
Date:       2007-09-27 10:13:42
Message-ID: 1190888022.638542.15850.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 717687 by mkretz:

workaround KIO deadlocks (well it's probably nicer anyway) by not recursing: a slot \
connected to a KIO signal would call another KIO function and this can lock up in \
waitForBytesWritten - qt-bugs mail already sent

 M  +17 -4     kiomediastream.cpp  
 M  +1 -0      kiomediastream.h  
 M  +1 -0      kiomediastream_p.h  


--- trunk/KDE/kdelibs/phonon/platform_kde/kiomediastream.cpp #717686:717687
@@ -101,7 +101,8 @@
             d->reading = true;
         } else if (!d->reading) {
             d->reading = true;
-            filejob->read(32768);
+            QMetaObject::invokeMethod(this, "_k_read", Qt::QueuedConnection);
+            //filejob->read(32768);
         }
     } else {
         // KIO::TransferJob
@@ -127,6 +128,7 @@
     Q_D(KioMediaStream);
     if (!d->kiojob || d->endOfDataSent) {
         // no job => job is finished and endOfData was already sent
+        kDebug(600) << "no job/job finished -> recreate it";
         reset();
     }
     Q_ASSERT(d->kiojob);
@@ -166,7 +168,8 @@
     if (reading) {
         KIO::FileJob *filejob = qobject_cast<KIO::FileJob *>(kiojob);
         Q_ASSERT(filejob);
-        filejob->read(32768);
+        //filejob->read(32768);
+        QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection);
     }
 }
 
@@ -221,7 +224,8 @@
     if (seeking) {
         filejob->seek(seekPosition);
     } else if (reading) {
-        filejob->read(32768);
+        //filejob->read(32768);
+        QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection);
     }
 }
 
@@ -232,12 +236,21 @@
     seeking = false;
     endOfDataSent = false;
     if (reading) {
+        Q_Q(KioMediaStream);
         KIO::FileJob *filejob = qobject_cast<KIO::FileJob *>(kiojob);
         Q_ASSERT(filejob);
-        filejob->read(32768);
+        //filejob->read(32768);
+        QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection);
     }
 }
 
+void KioMediaStreamPrivate::_k_read()
+{
+    KIO::FileJob *filejob = qobject_cast<KIO::FileJob *>(kiojob);
+    Q_ASSERT(filejob);
+    filejob->read(32768);
+}
+
 } // namespace Phonon
 
 #include "kiomediastream.moc"
--- trunk/KDE/kdelibs/phonon/platform_kde/kiomediastream.h #717686:717687
@@ -49,6 +49,7 @@
         Q_PRIVATE_SLOT(d_func(), void _k_bytestreamTotalSize(KJob *, qulonglong))
         Q_PRIVATE_SLOT(d_func(), void _k_bytestreamFileJobOpen(KIO::Job *))
         Q_PRIVATE_SLOT(d_func(), void _k_bytestreamSeekDone(KIO::Job *, \
KIO::filesize_t)) +        Q_PRIVATE_SLOT(d_func(), void _k_read())
 };
 
 } // namespace Phonon
--- trunk/KDE/kdelibs/phonon/platform_kde/kiomediastream_p.h #717686:717687
@@ -59,6 +59,7 @@
         void _k_bytestreamSeekStream(qint64);
         void _k_bytestreamFileJobOpen(KIO::Job *);
         void _k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t);
+        void _k_read();
 
         KUrl url;
         bool endOfDataSent;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic