Sorry about the delay in replying - my music server's fan broke and it's taken a while to get around to fixing it. I tested this with v11.1 now, and it no longer hangs on shutdown, but I have to click close (or choose File|Exit) three times in order to get it to shutdown - this happens 100% of the time. Here is the log:
0001797: SDK: CMJAutomation::CMJAutomation: Global Count: 3, Main 0, ffc348
0001797: General: CMCPlayerApp::InitInstance: Updating after database load
0001828: General: CPodcastMain::StartOperation: Start
0001828: General: CPodcastMain::StopOperation: Start
0001828: General: CPodcastMain::StopOperation: Finish (0 ms)
0001844: General: CPodcastMain::ReadConfiguration: Start
0001844: General: CPodcastMain::ReadConfiguration: Finish (0 ms)
0001844: General: CPodcastMain::StartOperation: Finish (16 ms)
0002000: General: CMCPlayerApp::InitInstance: Processing command line
0002000: General: CMCPlayerApp::ExecuteCommandLine: Start
0002016: General: CMCPlayerApp::ExecuteCommandLine: Command Line: -Embedding
0002016: General: CMCPlayerApp::Play: Start
0002016: General: CMCPlayerApp::Play: Command line: -Embedding
0002094: General: CMCPlayerApp::Play: Files: 0
0002094: General: CMCPlayerApp::Play: Finish (78 ms)
0002094: General: CMCPlayerApp::ExecuteCommandLine: Finish (94 ms)
0002094: General: CMCPlayerApp::InitInstance: Updating and showing UI
0002094: General: CMCPlayerApp::InitInstance: Updated window positioning
0002094: General: CMCPlayerApp::InitInstance: Updating startup settings
0002110: General: CMCPlayerApp::InitInstance: Version: JRiver Media Center 11.1.121 (registered)
0002110: General: CMCPlayerApp::InitInstance: Finish (2110 ms)
0002141: SDK: CMJAutomation::CMJAutomation: Global Count: 4, Main 1, f10420
0002156: General: CPodcastMain::Update: Start
0002156: General: CPodcastMain::TallyAndPurge: Start
0002172: General: CPodcastMain::TallyAndPurge: Search Complete
0002172: General: CPodcastMain::TallyAndPurge: Sort Complete
0002172: General: CPodcastMain::TallyAndPurge: Gathered Statistics
0002172: General: CPodcastMain::TallyAndPurge: Finish (16 ms)
0002188: General: CPodcastMain::Update: Finish (32 ms)
0002938: SDK: CMJPlaylistsAutomation::CMJPlaylistsAutomation: Global Count: 1
0002938: SDK: CMJCurPlaylistAutomation::CMJCurPlaylistAutomation: Global Count: 1
0002938: SDK: CMJPlaybackAutomation::CMJPlaybackAutomation: Global Count: 1
That's the end of the startup. At this point, I waited a few seconds, shut down my app, then waited about 5 seconds, chose File|Exit, waited another 5 seconds or so, chose File|Exit a second time - none of this seemed to generate any logging. I then waited 5 seconds or so, chose File|Exit a third time, at which point the following logging was generated, and MC11.1 shut down:
0046063: General: CMainFrame::OnDestroy: Start
0046063: General: CMCShutdownHelper::Cleanup: Start
0046063: General: CMCShutdownHelper::Cleanup: Source: CMainFrame - WM_DESTROY
0046063: General: CMCShutdownHelper::Cleanup: Setting shutdown flags
0046063: General: CMCShutdownHelper::Cleanup: Deleting frame member objects
0046063: General: CMCShutdownHelper::Cleanup: Saving data from UI
0046063: General: CMCShutdownHelper::Cleanup: Save window position
0046063: General: CMCShutdownHelper::Cleanup: Hiding UI
0046063: General: CMCShutdownHelper::Cleanup: Stopping playback
0046078: General: CMCShutdownHelper::Cleanup: Saving last exit mode
0046078: General: CMCShutdownHelper::Cleanup: Destroying UI
0046078: General: CMCShutdownHelper::Cleanup: Destroying main UI helper
0046078: General: CMCMainUIHelper::Destroy: Start
0046078: General: CMCMainUIHelper::Destroy: Destroying action windows
0046078: General: CMCMainUIHelper::Destroy: Destroying menu bars
0046078: General: CMCMainUIHelper::Destroy: Destroying player
0046141: General: CMCMainUIHelper::Destroy: Destroying borders
0046141: General: CMCMainUIHelper::Destroy: Destroying search control
0046141: General: CMCMainUIHelper::Destroy: Destroying status bar
0046141: General: CMCMainUIHelper::Destroy: Destroying tree
0046141: General: CMCMainUIHelper::Destroy: Finish (63 ms)
0046141: General: CMCShutdownHelper::Cleanup: Shutting down tools
0046141: General: CInterfacePlugins::CleanUp: Start
0046141: General: CInterfacePlugins::CleanUp: Clearing stored plugin information
0046141: General: CInterfacePlugins::CleanUp: Finish (0 ms)
0046266: General: CPodcastMain::StopOperation: Start
0046266: General: CPodcastMain::StopOperation: All workers cancelled
0046266: General: CPodcastMain::StopOperation: All workers deleted
0046266: General: CPodcastMain::StopOperation: Finish (0 ms)
0046266: General: CMCShutdownHelper::Cleanup: Running shutdown settings
0046266: General: CMCShutdownHelper::Cleanup: Destroying player core
0046266: SDK: CMJAutomation::OnFinalRelease: All objects released
0046266: SDK: CMJAutomation::~CMJAutomation: Global Count: 3
0046281: SDK: CMJAutomation::OnFinalRelease: All objects released
0046281: SDK: CMJAutomation::~CMJAutomation: Global Count: 2
0046281: SDK: CMJMixerAutomation::~CMJMixerAutomation: Global Count: 0
0046281: General: CMCShutdownHelper::Cleanup: Unloading database
0046344: General: CMCShutdownHelper::Cleanup: Clearing save timer
0046344: General: CMCShutdownHelper::Cleanup: Ending background threads
0046344: General: CMCShutdownHelper::Cleanup: Closing services
0046344: SDK: CMJAutomation::OnFinalRelease: All objects released
0046344: SDK: CMJAutomation::~CMJAutomation: Global Count: 1
0046344: General: CMCShutdownHelper::Cleanup: Restoring system settings
0046344: General: CMCShutdownHelper::Cleanup: Revoking automation SDK
0046344: General: CMCShutdownHelper::Cleanup: Releasing objects
0046344: General: CMCShutdownHelper::Cleanup: Unloading skinning
0046360: General: CMCShutdownHelper::Cleanup: Deleting MC core
0046360: General: CMCCore::Destroy: Start
0046360: General: CMCCore::Destroy: Deleting UI
0046360: General: CMCCore::Destroy: Deleting Tools
0046360: General: CMCCore::Destroy: Deleting Player
0046360: General: CMCCore::Destroy: Deleting DB
0046360: General: CMCCore::Destroy: Deleting Router
0046360: General: CMCCore::Destroy: Deleting Factory
0046360: General: CMCCore::Destroy: Deleting Flavor
0046360: General: CMCCore::Destroy: Deleting Services
0046360: General: CMCCore::Destroy: Finish (0 ms)
0046360: General: CMCShutdownHelper::Cleanup: Updating running flags
0046360: General: CMCShutdownHelper::Cleanup: Deleting global objects
0046360: General: CMainFrame::OnDestroy: Start
0046360: General: CMCShutdownHelper::Cleanup: Start
0046360: General: CMCShutdownHelper::Cleanup: Source: CMainFrame - WM_DESTROY
0046360: General: CMCShutdownHelper::Cleanup: Finish (0 ms)
0046360: General: CMainFrame::OnDestroy: Finish (0 ms)
0046360: General: CMCShutdownHelper::Cleanup: Finish (297 ms)
It looks like my code is not properly cleaning up the objects it is using, but I don't really see why that would be the case. Here is my code:
HRESULT hr = CoInitialize(NULL);
assert(hr == S_OK);
hr = MC.GetActiveObject(L"MediaJukebox Application");
if (hr != S_OK)
{
hr = MC.CreateInstance(L"MediaJukebox Application");
if (hr == S_OK)
{
MC->ShowProgram(1);
}
else
{
char Msg[500];
sprintf_s(Msg, sizeof(Msg), "Could not access MC automation interface (%#x)", hr);
MessageBox(0, Msg, "Error", MB_OK);
Running = FALSE;
return;
}
}
... (lots of code here) ...
MC.Release();
delete MC;
MC = NULL;