View Single Post
Old 07-30-2012, 02:37 AM   #468
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@kiwidude: it is possible that you are being bit by something that got me while developing the new smartdevice driver. It turns out that any plugin can be allocated and its __init__ called more than once. For example, this happened to my driver when I added a book.

The lesson I learned after discussion with Kovid: __init__ must not allocate externally-visible resources or initialize class-level attributes (attributes declared explicitly in the class). In my case I was allocating the listen socket in __init__, an action that blew up in the second __init__. The problem with class-level attributes is that they are static; they exist in memory only once. The second __init__ is changing the value of the same memory used by the first.
chaley is offline   Reply With Quote