Add some better error handling to the WMDM device lister if parts of WMP aren't installed

This commit is contained in:
David Sansome 2011-01-22 11:29:47 +00:00
parent c929db4637
commit 7880026767
3 changed files with 14 additions and 5 deletions

View File

@ -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?

View File

@ -55,6 +55,8 @@ WmdmLister::~WmdmLister() {
void WmdmLister::Init() {
thread_.reset(new WmdmThread);
if (!thread_->manager())
return;
// Register for notifications
IConnectionPointContainer* cp_container = NULL;

View File

@ -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() {
// Release the device manager
device_manager_->Release();
if (device_manager_) {
// Release the device manager
device_manager_->Release();
}
// SAC
CSecureChannelClient_Free(sac_);
if (sac_) {
// SAC
CSecureChannelClient_Free(sac_);
}
// Uninitialise COM
CoUninitialize();