Fix one source of segfaults on shutdown in the linux binaries. Minor fixes.

This commit is contained in:
Kovid Goyal 2011-05-13 10:09:45 -06:00
parent 4af9c1340e
commit a070127d1d
3 changed files with 12 additions and 7 deletions

View File

@ -30,11 +30,12 @@ int report_libc_error(const char *msg) {
} }
int pyobject_to_int(PyObject *res) { int pyobject_to_int(PyObject *res) {
int ret; PyObject *tmp; int ret = 0; PyObject *tmp;
tmp = PyNumber_Int(res); if (res != NULL) {
if (tmp == NULL) ret = (PyObject_IsTrue(res)) ? 1 : 0; tmp = PyNumber_Int(res);
else ret = (int)PyInt_AS_LONG(tmp); if (tmp == NULL) ret = (PyObject_IsTrue(res)) ? 1 : 0;
else ret = (int)PyInt_AS_LONG(tmp);
}
return ret; return ret;
} }

View File

@ -191,7 +191,11 @@ class OEBReader(object):
if not scheme and href not in known: if not scheme and href not in known:
new.add(href) new.add(href)
elif item.media_type in OEB_STYLES: elif item.media_type in OEB_STYLES:
for url in cssutils.getUrls(item.data): try:
urls = list(cssutils.getUrls(item.data))
except:
urls = []
for url in urls:
href, _ = urldefrag(url) href, _ = urldefrag(url)
href = item.abshref(urlnormalize(href)) href = item.abshref(urlnormalize(href))
scheme = urlparse(href).scheme scheme = urlparse(href).scheme

View File

@ -53,7 +53,7 @@ class StoreAction(InterfaceAction):
if self.gui.current_view() is self.gui.library_view: if self.gui.current_view() is self.gui.library_view:
author = self.gui.library_view.model().authors(row) author = self.gui.library_view.model().authors(row)
if author: if author:
author = author.replace('|', ',') author = author.replace('|', ' ')
else: else:
mi = self.gui.current_view().model().get_book_display_info(row) mi = self.gui.current_view().model().get_book_display_info(row)
author = ' & '.join(mi.authors) author = ' & '.join(mi.authors)