[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libktorrent/1.1] 8059530: Backport fix crash due to manipulating
From: Joris <joris.guisson () gmail ! com>
Date: 2011-01-05 19:13:23
Message-ID: 20110105191323.9C950A60B9 () git ! kde ! org
[Download RAW message or body]
commit 8059530289168be14f26a4786e9dd8cf18d67f90
branch 1.1
Author: Joris <joris.guisson@gmail.com>
Date: Wed Jan 5 20:11:02 2011 +0100
Backport fix crash due to manipulating timers in the wrong thread to 1.1 branch
CCBUG: 261903
diff --git a/ChangeLog b/ChangeLog
index 70eae64..026c730 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes in 1.1rc1:
- Fix bug in UPnP so that it works properly with D-Link DIR 635 routers
+- Fix crash due to manipulating timers in the wrong thread (261903)
Changes in 1.1beta1:
- Use UTF-8 as default codec in bt::Value::toString
diff --git a/src/download/httpconnection.cpp b/src/download/httpconnection.cpp
index 536e1aa..51fc500 100644
--- a/src/download/httpconnection.cpp
+++ b/src/download/httpconnection.cpp
@@ -37,8 +37,12 @@ namespace bt
status = i18n("Not connected");
connect(&reply_timer,SIGNAL(timeout()),this,SLOT(replyTimeout()));
connect(&connect_timer,SIGNAL(timeout()),this,SLOT(connectTimeout()));
+ connect(this,SIGNAL(startReplyTimer(int)),&reply_timer,SLOT(start(int)),Qt::QueuedConnection);
+ connect(this,SIGNAL(stopReplyTimer()),&reply_timer,SLOT(stop()),Qt::QueuedConnection);
+ connect(this,SIGNAL(stopConnectTimer()),&connect_timer,SLOT(stop()),Qt::QueuedConnection);
up_gid = down_gid = 0;
close_when_finished = false;
+ redirected = false;
}
@@ -133,7 +137,7 @@ namespace bt
response_code = request->response_code;
}
else if (request->response_header_received)
- reply_timer.stop();
+ stopReplyTimer();
}
}
}
@@ -154,7 +158,7 @@ namespace bt
state = ERROR;
status = i18n("Error: Failed to connect to webseed");
}
- connect_timer.stop();
+ stopConnectTimer();
}
else if (state == ACTIVE && request)
{
@@ -173,7 +177,7 @@ namespace bt
g->buffer.clear();
g->request_sent = true;
// wait 60 seconds for a reply
- reply_timer.start(60 * 1000);
+ startReplyTimer(60 * 1000);
}
return len;
}
@@ -324,9 +328,12 @@ namespace bt
void HttpConnection::replyTimeout()
{
QMutexLocker locker(&mutex);
- status = i18n("Error: request timed out");
- state = ERROR;
- reply_timer.stop();
+ if (!request || !request->response_header_received)
+ {
+ status = i18n("Error: request timed out");
+ state = ERROR;
+ reply_timer.stop();
+ }
}
////////////////////////////////////////////
diff --git a/src/download/httpconnection.h b/src/download/httpconnection.h
index 4a5c319..c2a8414 100644
--- a/src/download/httpconnection.h
+++ b/src/download/httpconnection.h
@@ -160,6 +160,11 @@ namespace bt
void hostResolved(KNetwork::KResolverResults res);
void connectTimeout();
void replyTimeout();
+
+ signals:
+ void startReplyTimer(int timeout);
+ void stopReplyTimer();
+ void stopConnectTimer();
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic