mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix one source of segfaults on shutdown in the linux binaries. Minor fixes.
This commit is contained in:
parent
4af9c1340e
commit
a070127d1d
@ -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;
|
||||||
|
if (res != NULL) {
|
||||||
tmp = PyNumber_Int(res);
|
tmp = PyNumber_Int(res);
|
||||||
if (tmp == NULL) ret = (PyObject_IsTrue(res)) ? 1 : 0;
|
if (tmp == NULL) ret = (PyObject_IsTrue(res)) ? 1 : 0;
|
||||||
else ret = (int)PyInt_AS_LONG(tmp);
|
else ret = (int)PyInt_AS_LONG(tmp);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user