07-30-2012, 12:40 AM | #466 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
@Kiwidude; still seeing occurrences of
Code:
calibre, version 0.8.62 ERROR: Unhandled exception: <b>RuntimeError</b>:wrapped C/C++ object of %S has been deleted Traceback (most recent call last): File "calibre_plugins.reading_list.config", line 773, in on_device_connection_changed File "calibre_plugins.reading_list.config", line 862, in update_from_connection_status File "calibre_plugins.reading_list.config", line 376, in get_data RuntimeError: wrapped C/C++ object of %S has been deleted Then when I attach my device and it is processing either the Auto Update list or the Send to Device list, that error happens. Also just received an occurrence on Eject Device. Will see if I can get a calibre debug log and a repeatable failure. |
07-30-2012, 12:52 AM | #467 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
As far as I can tell these are the steps I did:
Spoiler:
|
Advert | |
|
07-30-2012, 02:37 AM | #468 |
Grand Sorcerer
Posts: 11,734
Karma: 6690881
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. |
07-30-2012, 03:41 AM | #469 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@chaley - thx for the info and that makes sense, but why would __init__() be being called more than once on a GUI plugin? Surely only one instance of the Reading List plugin is ever being created?
What happens with this plugin is that the configuration widget subscribes to some signals from the plugin action, which it uses to updates its grid to shwo device status, in case a user plugs in a device while they have the config screen open. It looks to me like those signals are not being disconnected in PeterT's case (I can't replicate the error myself). At the moment I disconnect those signals in an __exit__() function on my config widget, but that must be the wrong place for PeterT. The problem is that there are no guaranteed callbacks to my widget from calibre's do_user_config code() if the user does not click on "ok" so that save_settings gets called. So where should I put my signal disconnections? I am guessing that the Qt object the config widget uses is being garbage collected before the Python ConfigWidget is, so my __exit__ has not yet been called or something. However since from a config widget you have no hooks to the parent dialog I can't think of a way out of this that doesn't involve calibre looking for an optional functional name on the config widget to call as a "cleanup" that I could disconnect in that gets invoked when the config dialog is closed? Last edited by kiwidude; 07-30-2012 at 03:53 AM. |
07-30-2012, 04:07 AM | #470 |
creator of calibre
Posts: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@kiwidude: In the slot your are connecting to the signal, use
import sip if sip.isdeleted(self): return sip.isdeleted() returns True if the underlying C++ object has been deleted. |
Advert | |
|
07-30-2012, 04:14 AM | #471 | |||
Grand Sorcerer
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Quote:
Doesn't do_user_config open a Qt widget of some kind? If so, then override the accept and reject methods. One of the two of these will get called when the dialog is closed in some way. Another possibility is to connect the signals to methods that will not go away. These methods verify the situation and pass the calls along only when it is correct to do so. This way you connect the signal once, never disconnecting it. Edit: Kovid has provided a method to check if it is correct to pass the call along. |
|||
07-30-2012, 08:31 AM | #472 |
Member
Posts: 13
Karma: 10
Join Date: Jun 2012
Device: Sony T1
|
Feature request - Checkboxes?
Hi kiwidude,
most of the time I add a book to more than one reading list and it's a bit tedious to go "Reading List" -> Add to list -> List A several times per book. I have no inkling about writing software so I don't know if this is even possible but it would be really cool to have a list of the lists (ha!) displayed with checkboxes. This way you wouldn't even need the "add to" and "remove from" menu items, because you could see if the book is on the list by looking at the checkboxes. Just dreaming here ... Take care, Ingrid |
07-30-2012, 08:53 AM | #473 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Beta for next version
@Kovid/chaley, thx for the info. The __exit__ was just a brain fart on my part a long time ago. I figured out a solution (overriding do_user_config so that I can disconnect).
@PeterT - please give the attached version a whirl to see if it solves the issue for you. @darkmiss - I've enhanced the "Move to list" option to allow you to select multiple lists on the RHS. So use that option instead of the Add menus. Can you also please give the attached version a whirl and verify it is working without issues for you. I wiill release it officially when you have both replied. Last edited by kiwidude; 07-30-2012 at 02:39 PM. Reason: Removed attachment as officially released |
07-30-2012, 10:33 AM | #474 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
@Kiwidude; so far seems fine. I will try a few more times but it was reproducible at will last night and is not now.
OOPS.. Spoke to soonn.. Trying to go reinvoke the plugin after ejecting now gets the following Spoiler:
|
07-30-2012, 10:37 AM | #475 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
It does not even need the device to be attached; just try to launch Reading list | Customize twice in a row
Spoiler:
|
07-30-2012, 11:13 AM | #476 |
Member
Posts: 13
Karma: 10
Join Date: Jun 2012
Device: Sony T1
|
Thanks for the prompt reply, kiwidude. I tested the "move to list" -> perfect. It will be a great time saver!
Regards from Germany, Ingrid |
07-30-2012, 11:33 AM | #477 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@darkmiss - thx for the feedback.
@PeterT - try the new version above. I am at work and USB is blocked so I wasn't able to test the attaching here, and did something stupid in the code... |
07-30-2012, 11:44 AM | #478 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
@Kiwidude; looks good
|
07-30-2012, 11:54 AM | #479 |
Connoisseur
Posts: 60
Karma: 5090
Join Date: Jun 2009
Device: Gen3, Kobo glow
|
Will this plugin help create/manage kobo touch shelves in recent 2.0 firmware ?
|
07-30-2012, 12:20 PM | #480 |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
@Magphil: nope
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Extract ISBN | kiwidude | Plugins | 532 | 04-07-2024 11:01 AM |
[GUI Plugin] Open With | kiwidude | Plugins | 403 | 04-01-2024 08:39 AM |
[GUI Plugin] Manage Sony x50 Reader Book List | kpw | Plugins | 170 | 10-02-2014 08:23 PM |
[GUI Plugin] Temp Marker | kiwidude | Plugins | 41 | 10-14-2013 12:25 AM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |