jash-kothari-forks / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

alert::clone isn't available in python wrapper #489

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There is no way to copy alert objects in python.

Original issue reported on code.google.com by fel...@mp2p.net on 24 Jun 2013 at 12:56

GoogleCodeExporter commented 8 years ago
Does this patch solve the problem for you? It makes alerts be held by a smart 
pointer. I'm assuming you don't actually need to copy the object, since it's 
immutable anyway.

Original comment by arvid.no...@gmail.com on 25 Jun 2013 at 10:40

Attachments:

GoogleCodeExporter commented 8 years ago
Currently, alert objects of the same type are reused (I detected this problem 
queuing alerts for parallelization), making alert objects immutable effectively 
solves the problem in a pythonic way.

Thanks.

Original comment by fel...@mp2p.net on 27 Jun 2013 at 7:52

GoogleCodeExporter commented 8 years ago
reused? You mean two alerts of the same type always have the same value?

Original comment by arvid.no...@gmail.com on 28 Jun 2013 at 3:13

GoogleCodeExporter commented 8 years ago
I mean two consecutive session::pop_alert() calls, returning alerts of the same 
type (tested with torrent_alerts) causes the first alert's data became 
overwritten with second's one.

Original comment by fel...@mp2p.net on 2 Jul 2013 at 2:38

GoogleCodeExporter commented 8 years ago
I wonder if this is because the first one goes out of scope somehow, and the 
heap allocator decides to pick the same memory for the next alert.

Is this with out without the patch btw? or does it not matter?

The patch makes the alert be held by a shared_ptr, and may affect this.

Original comment by arvid.no...@gmail.com on 3 Jul 2013 at 4:43