Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 02-21-2012, 05:59 PM   #1
ramsonb
Junior Member
ramsonb began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2012
Device: SONY PRTS1
crash after several self.db.bulk_modify_tags

i am writing a plugin to modify tags; after calling
Code:
self.db.bulk_modify_tags(...)
i do
Code:
self.db.refresh()
self.gui.library_view.model().refresh_ids(arBooks) # arBooks contains the ids of the modified books
self.gui.tags_view.recount()
self.gui.library_view.refresh_book_details()
and the main calibre interface gets updated correctly, futhermore the tag tree shows the correct new numbers perfectly.

So far so good, after several bulk_modify_tags calibre completely crahes no stack trace is printed to stdout.

I am starting clibre with
Code:
calibre-debug -g
I already tried not doing the self.gui.* stuff, but there are still crashes ...

Any help would be welcome.

regards
ramson

Last edited by ramsonb; 02-21-2012 at 06:04 PM.
ramsonb is offline   Reply With Quote
Old 02-21-2012, 06:02 PM   #2
ramsonb
Junior Member
ramsonb began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2012
Device: SONY PRTS1
i have attached the plugin, please keep in mind that this is work in progress
Attached Files
File Type: zip Merge_Tags.zip (98.8 KB, 231 views)
ramsonb is offline   Reply With Quote
Advert
Old 02-22-2012, 03:33 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Generally, with this kind of thing, the likely cause is some PyQt object being garbage collected at the wrong time, while the underlying Qt object still is receiving signals or something like that. I doubt that bulk_modify_tags is the cause of the crash. You can test that by doing lots of bulk modification of tags in calibre via the bulk edit metadata dialog.
kovidgoyal is offline   Reply With Quote
Old 02-22-2012, 12:28 PM   #4
ramsonb
Junior Member
ramsonb began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2012
Device: SONY PRTS1
thanks for the quick reply, i didn't say there was a bug in bulk_modify_tags, the code looks good and i have already used the internal tag browser with no problem.

I was unsure if
Code:
self.db.refresh()
self.gui.library_view.model().refresh_ids(arBooks) # arBooks contains the ids of the modified books
self.gui.tags_view.recount()
self.gui.library_view.refresh_book_details()
is the right way to tell cilbre to update its tag browser and books displayed.

Furthermore do you have any tips how to get some debug information in such a case.

thanks in advance
ramson
ramsonb is offline   Reply With Quote
Old 02-22-2012, 12:43 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you look at the edit_metadata() method in actions/edit_metadata.py you will see how the UI is refreshed after a metadata edit operation (bulk or single). Use the same code. Though I thought you said that the crash happened even when you removed the refresh code.

As for debugging these crashes, there's no easy way. If you run calibre on linux, you can compile python, pyqt, sip and qt with -ggdb and then get back traces with gdb, but the backtraces are not awfully helpful. The most effective technique is to look for PyQt objects going out of scope and getting garbage collected. Try to aggressively keep references to every pyqt object you create.
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Startup crash Phyrefly Calibre 2 06-17-2011 12:27 PM
Crash on these epubs lorenzoens enTourage Archive 0 05-08-2011 01:03 PM
0.7.30 crash nickredding Calibre 1 11-27-2010 01:40 PM
PRS-600 Dictionary Crash. FlatlineTech Sony Reader 8 04-21-2010 02:18 PM
My first crash on the PRS700. Wetdogeared Sony Reader 10 12-14-2008 06:23 AM


All times are GMT -4. The time now is 06:12 PM.


MobileRead.com is a privately owned, operated and funded community.