Fixed the crash bug in the iTunesPlugin.

This commit is contained in:
Kimmo Pekkola 2009-07-30 20:31:52 +00:00
parent 86f75fe243
commit 3c98bd5de4
2 changed files with 17 additions and 5 deletions

View File

@ -294,7 +294,8 @@ static bool updateCurrentTrack()
if (0 == lastClock || currentClock - lastClock > CLOCKS_PER_SEC)
{
wsprintf(CurrentTrackArtworkPath, L"%s%s", BaseDir, DefaultTrackArtworkPath);
CurrentTrack.Release();
if (CurrentTrack != NULL)
CurrentTrack.Release();
if (FAILED(iTunes->get_CurrentTrack(&CurrentTrack)) || !CurrentTrack)
return false;
@ -362,11 +363,22 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
CoInitialized = true;
}
if (CoInitialized && !InstanceCreated && ::FindWindow(L"iTunes", L"iTunes") &&
SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
if (CoInitialized && !InstanceCreated /*&& ::FindWindow(L"iTunes", L"iTunes") */) // rainy: Removed the FindWindow since it fails in 64-bit OS
{
InstanceCreated = true;
if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
{
InstanceCreated = true;
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesApp initialized successfully.");
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to create the iTunesApp instance.");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to find the iTunes window.");
}
const wchar_t* type = ReadConfigString(section, L"Command", L"");
for(int i = 0; i < COMMAND_COUNT; i++)

View File

@ -1,2 +1,2 @@
#pragma once
const int revision_number = 117;
const int revision_number = 119;