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,6 +294,7 @@ static bool updateCurrentTrack()
if (0 == lastClock || currentClock - lastClock > CLOCKS_PER_SEC)
{
wsprintf(CurrentTrackArtworkPath, L"%s%s", BaseDir, DefaultTrackArtworkPath);
if (CurrentTrack != NULL)
CurrentTrack.Release();
if (FAILED(iTunes->get_CurrentTrack(&CurrentTrack)) || !CurrentTrack)
return false;
@ -362,10 +363,21 @@ 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
{
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"");

View File

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