Add some better error handling to the WMDM device lister if parts of WMP aren't installed
This commit is contained in:
parent
c929db4637
commit
7880026767
@ -73,6 +73,8 @@ bool WmdmDevice::StartCopy(QList<Song::FileType>* supported_types) {
|
||||
|
||||
// This initialises COM and gets a connection to the device
|
||||
thread_.reset(new WmdmThread);
|
||||
if (!thread_->manager())
|
||||
return false;
|
||||
|
||||
// Find a place to put the files. We default to the root folder for now, but
|
||||
// could look for a "Music" folder in the future?
|
||||
|
@ -55,6 +55,8 @@ WmdmLister::~WmdmLister() {
|
||||
|
||||
void WmdmLister::Init() {
|
||||
thread_.reset(new WmdmThread);
|
||||
if (!thread_->manager())
|
||||
return;
|
||||
|
||||
// Register for notifications
|
||||
IConnectionPointContainer* cp_container = NULL;
|
||||
|
@ -29,7 +29,8 @@ BYTE abCert[] = {0x00};
|
||||
|
||||
|
||||
WmdmThread::WmdmThread()
|
||||
: device_manager_(NULL)
|
||||
: device_manager_(NULL),
|
||||
sac_(NULL)
|
||||
{
|
||||
// Initialise COM
|
||||
CoInitialize(0);
|
||||
@ -63,11 +64,15 @@ WmdmThread::WmdmThread()
|
||||
}
|
||||
|
||||
WmdmThread::~WmdmThread() {
|
||||
if (device_manager_) {
|
||||
// Release the device manager
|
||||
device_manager_->Release();
|
||||
}
|
||||
|
||||
if (sac_) {
|
||||
// SAC
|
||||
CSecureChannelClient_Free(sac_);
|
||||
}
|
||||
|
||||
// Uninitialise COM
|
||||
CoUninitialize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user