INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Help - Crash using IMJCurPlaylistAutomation?  (Read 2035 times)

MahlerFreak

  • Recent member
  • *
  • Posts: 49
Help - Crash using IMJCurPlaylistAutomation?
« on: October 19, 2006, 03:11:52 pm »

I am experiencing an intermittent crash when using the current playlist automation interface to reset the nowplaying list. My code uses the interface to first clear nowplaying, by calling RemoveAllFiles, then
adding a sequence of files using AddFileByKey, adding the files at the last position in every case. This code often works correctly, but if invoked enough times, eventually causes a crash. The automation calls are made from a separate thread, and the the crash never occurs until my thread is finished processing. I'm running MC 11.1.200. Any help would be greatly appreciated - this is the last holdup keeping me from sending out my application to an anxious client for early testing. The other automation interfaces work very well for me, BTW.



The error reported in the VC++ debugger is:

HEAP[Media Center.exe]: Invalid Address specified to RtlFreeHeap( 003B0000, 00F34110 )
Windows has triggered a breakpoint in Media Center.exe.

This may be due to a corruption of the heap, and indicates a bug in Media Center.exe or any of the DLLs it has loaded.

The output window may have more diagnostic information
The program '[1148] Media Center.exe: Native' has exited with code 0 (0x0).



The call stack in VC++ is identical each time, as follows:


        ntdll.dll!7c901230()    
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]   
    ntdll.dll!7c96c943()    
    ntdll.dll!7c96cd80()    
    ntdll.dll!7c96df66()    
    ntdll.dll!7c926abe()    
    ntdll.dll!7c94a5d0()    
    ntdll.dll!7c94a5d0()    
    ntdll.dll!7c96e0d4()    
    ntdll.dll!7c94a5d0()    
    ntdll.dll!7c926abe()    
    JRTools.dll!0147de0c()    
    ntdll.dll!7c9268ad()    
    user32.dll!77d4882a()    
    user32.dll!77d4b4c0()    
    user32.dll!77d4b4cb()    
    Media Center.exe!0072cdcc()    
    Media Center.exe!0075a79b()    
    Media Center.exe!0043a68c()    
    Media Center.exe!006c1af8()    
    Media Center.exe!006069ad()    
    Media Center.exe!00435ae0()    
    Media Center.exe!00435a98()    
    Media Center.exe!00430ec0()    
    Media Center.exe!0043186c()    
    Media Center.exe!00775926()    
    Media Center.exe!0043288f()    
    Media Center.exe!00548c5f()    
    Media Center.exe!0054aa9e()    
    Media Center.exe!00546798()    
    Media Center.exe!00554411()    
    Media Center.exe!005470e3()    
    Media Center.exe!00546daa()    
    Media Center.exe!0075f3bb()    
    Media Center.exe!0075df2d()    
    Media Center.exe!0075bfe7()    
    Media Center.exe!0066b5d5()    
    Media Center.exe!0054a54d()    
    Media Center.exe!0075de9d()    
    Media Center.exe!0075df2d()    
    user32.dll!77d48734()    
    user32.dll!77d48816()    
    user32.dll!77d4c63f()    
    user32.dll!77d4c665()    
    JRTools.dll!014711ec()    
    user32.dll!77d4882a()    
    user32.dll!77d4c63f()    
    user32.dll!77d4b6a3()    
    gdi32.dll!77f15a1e()    
    user32.dll!77d484b2()    
    user32.dll!77d486be()    
    Media Center.exe!004084f2()    
    Media Center.exe!0075f3bb()    
    Media Center.exe!005f6ea5()    
    Media Center.exe!0075f3bb()    
    user32.dll!77d4882a()    
    user32.dll!77d4c63f()    
    Media Center.exe!0075bfe7()    
    Media Center.exe!004e53bc()    
    Media Center.exe!0075bfe7()    
    Media Center.exe!0075de9d()    
    JRTools.dll!0147de0c()    
    JRTools.dll!01473858()    
    user32.dll!77d48734()    
    user32.dll!77d48816()    
    user32.dll!77d4b4c0()    
    user32.dll!77d4b50c()    
    ntdll.dll!7c90eae3()    
    user32.dll!77d494be()    
    user32.dll!77d4d890()    
    user32.dll!77d4b903()    
    Media Center.exe!005837c0()    
    Media Center.exe!004ac016()    
    Media Center.exe!00527c83()    
    Media Center.exe!0075f3bb()    
    Media Center.exe!0075bfe7()    
    Media Center.exe!0075de9d()    
    Media Center.exe!0075bfe7()    
    Media Center.exe!0075de9d()    
    Media Center.exe!0075df2d()    
    user32.dll!77d48734()    
    user32.dll!77d48816()    
    user32.dll!77d489cd()    
    user32.dll!77d491f1()    
    user32.dll!77d48a10()    
    Media Center.exe!004ac1c8()    
    Media Center.exe!0075b3ff()    
    Media Center.exe!00762e5c()    
    Media Center.exe!0072c3e8()    
    Media Center.exe!0072c27d()    
    kernel32.dll!7c816fd7()    
    Media Center.exe!0072006f()    
    Media Center.exe!0074002c()    
    Media Center.exe!00640047()    
    Media Center.exe!00640047()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!00640047()    
    Media Center.exe!005f0073()    
    Media Center.exe!00640047()    
    Media Center.exe!005f0073()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00740072()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!005f0073()    
    Media Center.exe!0072006f()    
    Media Center.exe!005f0073()    
    Media Center.exe!00650000()    
    Media Center.exe!00640047()    
    Media Center.exe!00640047()    
    Media Center.exe!00700074()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()


Maybe a clue - I notice when building the app from scratch, I get warnings emitted when processing the media center Type Library, as follows: (note that one of these functions is part of CurPlaylistAutomation)

c:\documents and settings\scott borduin\my documents\visual studio 2005\projects\jrmcserver\jrmcserver\stdafx.h(39) : warning C4278: 'DeleteFile': identifier in type library '\Program Files\J River\Media Center 11\Media Center.tlb' is already a macro; use the 'rename' qualifier
1>c:\documents and settings\scott borduin\my documents\visual studio 2005\projects\jrmcserver\jrmcserver\stdafx.h(39) : warning C4278: 'MoveFile': identifier in type library '\Program Files\J River\Media Center 11\Media Center.tlb' is already a macro; use the 'rename' qualifier
1>c:\documents and settings\scott borduin\my documents\visual studio 2005\projects\jrmcserver\jrmcserver\stdafx.h(39) : warning C4278: 'ReportEvent': identifier in type library '\Program Files\J River\Media Center 11\Media Center.tlb' is already a macro; use the 'rename' qualifier

Logged

MahlerFreak

  • Recent member
  • *
  • Posts: 49
Re: Help - Crash using IMJCurPlaylistAutomation?
« Reply #1 on: October 19, 2006, 03:35:15 pm »

Follow up: I thought I had tried most of the obvious workarounds, but then figured out this one:

If I add the files by filename instead, the crash does not seem to occur, at least so far. Pseudo code follows.

IMJAutomationPtr pAuto = ....
IMJCurPlaylistAutomationPtr pCurPlaylist = ...

for ( ... )
// eventually causes a barf
pCurPlaylist->AddFileByKey(nextKey,pos);

// works fine, albeit somewhat more slowly:
IMJFileAutomationPtr pFileAuto = pAuto->GetFile(nextKey);
bstr_t sFilename = pFileAuto->GetFilename();
pCurPlaylist->AddFile(sFilename,pos);

Logged

MahlerFreak

  • Recent member
  • *
  • Posts: 49
Re: Help - Crash using IMJCurPlaylistAutomation?
« Reply #2 on: October 19, 2006, 04:05:40 pm »

And sadly, not so fast. If I now follow up the addition of those files to the current playlist with a call to MJPlaybackAutomation::Play(), it sometimes works but often crashes with an "Invalid Handle" exception. All of the playback automation interfaces work fine for me if I don't manipulate the current playlist first. Is this possibly a timing issue of some kind?

VC++ debug output:

First-chance exception at 0x7c90eb74 in Media Center.exe: 0xC0000008: An invalid handle was specified.


Call stack:

   ntdll.dll!7c90eb74()    
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]   
    ntdll.dll!7c90eb74()    
    user32.dll!77d4929b()    
    user32.dll!77d49402()    
    ntdll.dll!7c90d592()    
    ntdll.dll!7c91973a()    
    Media Center.exe!004a77da()    
    Media Center.exe!004a7d2c()    
    Media Center.exe!0056cd65()    
    Media Center.exe!0056d028()    
    Media Center.exe!0056cfea()    
    Media Center.exe!0056d05e()    
    Media Center.exe!004a7873()    
    user32.dll!77d48734()    
    user32.dll!77d48816()    
    user32.dll!77d489cd()    
    user32.dll!77d491f1()    
    user32.dll!77d48a10()    
    Media Center.exe!004ac1c8()    
    Media Center.exe!0075b3ff()    
    Media Center.exe!00762e5c()    
    Media Center.exe!0072c3e8()    
    Media Center.exe!0072c27d()    
    kernel32.dll!7c816fd7()    
    Media Center.exe!0072006f()    
    Media Center.exe!0074002c()    
    Media Center.exe!00640047()    
    Media Center.exe!00640047()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!00640047()    
    Media Center.exe!005f0073()    
    Media Center.exe!00640047()    
    Media Center.exe!005f0073()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00740072()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!00630072()    
    Media Center.exe!00540079()    
    Media Center.exe!006e006f()    
    Media Center.exe!0072006f()    
    Media Center.exe!005f0073()    
    Media Center.exe!0072006f()    
    Media Center.exe!005f0073()    
    Media Center.exe!00650000()    
    Media Center.exe!00640047()    
    Media Center.exe!00640047()    
    Media Center.exe!00700074()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
    Media Center.exe!00740072()    
    Media Center.exe!00700074()    
Logged

MahlerFreak

  • Recent member
  • *
  • Posts: 49
Re: Help - Crash using IMJCurPlaylistAutomation?
« Reply #3 on: October 19, 2006, 04:41:20 pm »

And just to throw one more curveball, based on my speculation about timing above. If I insert a 1/2 second sleep between manipulating the now playing list, and executing the play command, the crash seems to go away. Bizzare but true. It may be that MC has some thread race issues that only show up when called from the automation interface?
Logged
Pages: [1]   Go Up