Comment 47 for bug 426611

Revision history for this message
In , Osterfeld (osterfeld) wrote :

As this seems to be a major issue, here is the workaround I mentioned above.
It's not the "proper" fix, but should fix the crash and could be included as hotfix, for 4.3.1. Andreas?

diff --git a/kio/kio/slave.cpp b/kio/kio/slave.cpp
index 28c8417..13171d9 100644
--- a/kio/kio/slave.cpp
+++ b/kio/kio/slave.cpp
@@ -319,6 +319,10 @@ void Slave::gotInput()
 {
     Q_D(Slave);
     ref();
+ //the following 'that' guard is a hotfix for bug 191589 (see comment #15 for some analysis)
+ //and should removed again as soon as someone knowing more about KIO than me looked into it
+ //and hopefully has a proper fix. -Frank Osterfeld
+ QPointer<QObject> that(this);
     if (!dispatch())
     {
         d->connection->close();
@@ -332,7 +336,8 @@ void Slave::gotInput()
         // Tell the scheduler about the problem.
         emit slaveDied(this);
     }
- deref();
+ if (that)
+ deref();
     // Here we might be dead!!
 }