File kdebase-trident-udisks2-fix-endless-loop.diff of Package kdebase3

--- a/kioslave/media/mediamanager/udisks2backend.cpp
+++ b/kioslave/media/mediamanager/udisks2backend.cpp
@@ -19,6 +19,7 @@
 
 #include <qdict.h>
 #include <qeventloop.h>
+#include <qtimer.h>
 
 #include <dbus/qdbusconnection.h>
 #include <dbus/qdbuserror.h>
@@ -83,6 +84,7 @@
 
 private slots:
     void callMethodCallback(const QDBusMessage &message);
+    void forceUnmount();
 
 private:
     Medium *createLoopMedium();
@@ -381,6 +383,12 @@
 {
     callbackResponse = message;
     kapp->eventLoop()->exitLoop();
+}
+
+
+void Object::forceUnmount()
+{
+    unmount(true);
 }
 
 
@@ -534,7 +542,8 @@
     else {
         m_objectManager->m_mediaList.removeMedium(path(), true);
         if(m_mounted)
-            unmount(true);
+            // delay the unmount to avoid recursive D-BUS dispatching (which falling into endless loop)
+            QTimer::singleShot(0, this, SLOT(forceUnmount()));
     }
 
     m_mediaAvailable = mediaAvailable;