merged python binding fix from RC_0_16

This commit is contained in:
Arvid Norberg
2012-09-11 17:20:31 +00:00
parent 0ec16827ff
commit 49709d1e3f

View File

@@ -100,10 +100,12 @@ namespace
} }
dict session_get_settings(session const& ses) dict session_get_settings(session const& ses)
{
session_settings sett;
{ {
allow_threading_guard guard; allow_threading_guard guard;
sett = ses.settings();
session_settings sett = ses.settings(); }
dict sett_dict; dict sett_dict;
bencode_map_entry* map; bencode_map_entry* map;
int len; int len;
@@ -264,8 +266,6 @@ namespace
feed_handle add_feed(session& s, dict params) feed_handle add_feed(session& s, dict params)
{ {
allow_threading_guard guard;
feed_settings feed; feed_settings feed;
// this static here is a bit of a hack. It will // this static here is a bit of a hack. It will
// probably work for the most part // probably work for the most part
@@ -273,14 +273,17 @@ namespace
std::list<std::string> string_storage; std::list<std::string> string_storage;
dict_to_feed_settings(params, feed, resume_buf, string_storage); dict_to_feed_settings(params, feed, resume_buf, string_storage);
allow_threading_guard guard;
return s.add_feed(feed); return s.add_feed(feed);
} }
dict get_feed_status(feed_handle const& h) dict get_feed_status(feed_handle const& h)
{
feed_status s;
{ {
allow_threading_guard guard; allow_threading_guard guard;
s = h.get_feed_status();
feed_status s = h.get_feed_status(); }
dict ret; dict ret;
ret["url"] = s.url; ret["url"] = s.url;
ret["title"] = s.title; ret["title"] = s.title;
@@ -313,8 +316,6 @@ namespace
void set_feed_settings(feed_handle& h, dict sett) void set_feed_settings(feed_handle& h, dict sett)
{ {
allow_threading_guard guard;
feed_settings feed; feed_settings feed;
static std::vector<char> resume_buf; static std::vector<char> resume_buf;
std::list<std::string> string_storage; std::list<std::string> string_storage;
@@ -323,10 +324,12 @@ namespace
} }
dict get_feed_settings(feed_handle& h) dict get_feed_settings(feed_handle& h)
{
feed_settings s;
{ {
allow_threading_guard guard; allow_threading_guard guard;
s = h.settings();
feed_settings s = h.settings(); }
dict ret; dict ret;
ret["url"] = s.url; ret["url"] = s.url;
ret["auto_download"] = s.auto_download; ret["auto_download"] = s.auto_download;
@@ -354,9 +357,12 @@ namespace
list get_torrents(session& s) list get_torrents(session& s)
{ {
allow_threading_guard guard;
list ret; list ret;
std::vector<torrent_handle> torrents = s.get_torrents(); std::vector<torrent_handle> torrents;
{
allow_threading_guard guard;
torrents = s.get_torrents();
}
for (std::vector<torrent_handle>::iterator i = torrents.begin(); i != torrents.end(); ++i) for (std::vector<torrent_handle>::iterator i = torrents.begin(); i != torrents.end(); ++i)
{ {