mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
6213d10bcd
commit
be3792c5c5
@ -179,7 +179,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static PyObject* bulk_get_filesystem(IPortableDevice *device, IPortableDevicePropertiesBulk *bulk_properties, const wchar_t *storage_id, IPortableDevicePropVariantCollection *object_ids) {
|
static PyObject* bulk_get_filesystem(IPortableDevice *device, IPortableDevicePropertiesBulk *bulk_properties, const wchar_t *storage_id, IPortableDevicePropVariantCollection *object_ids) {
|
||||||
PyObject *folders = NULL, *ret = NULL;
|
PyObject *folders = NULL;
|
||||||
GUID guid_context = GUID_NULL;
|
GUID guid_context = GUID_NULL;
|
||||||
HANDLE ev = NULL;
|
HANDLE ev = NULL;
|
||||||
IPortableDeviceKeyCollection *properties;
|
IPortableDeviceKeyCollection *properties;
|
||||||
@ -230,22 +230,16 @@ static PyObject* bulk_get_filesystem(IPortableDevice *device, IPortableDevicePro
|
|||||||
}
|
}
|
||||||
PyEval_RestoreThread(callback->thread_state);
|
PyEval_RestoreThread(callback->thread_state);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
// We deliberately leak the callback object to prevent any crashes in case COM tries to call methods on it during a future pump_waiting_messages()
|
bulk_properties->Cancel(guid_context);
|
||||||
PyDict_Clear(folders);
|
pump_waiting_messages();
|
||||||
folders = NULL;
|
Py_DECREF(folders); folders = NULL;
|
||||||
callback = NULL;
|
|
||||||
ev = NULL;
|
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
if (folders != NULL) {
|
|
||||||
ret = PyDict_Values(folders);
|
|
||||||
Py_DECREF(folders);
|
|
||||||
}
|
|
||||||
if (ev != NULL) CloseHandle(ev);
|
if (ev != NULL) CloseHandle(ev);
|
||||||
if (properties != NULL) properties->Release();
|
if (properties != NULL) properties->Release();
|
||||||
if (callback != NULL) callback->Release();
|
if (callback != NULL) callback->Release();
|
||||||
|
|
||||||
return ret;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL find_all_objects_in(IPortableDeviceContent *content, IPortableDevicePropVariantCollection *object_ids, const wchar_t *parent_id) {
|
static BOOL find_all_objects_in(IPortableDeviceContent *content, IPortableDevicePropVariantCollection *object_ids, const wchar_t *parent_id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user