INTERACT FORUM

Please login or register.

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

Author Topic: COM Deadlock  (Read 2573 times)

johnnynine

  • Guest
COM Deadlock
« on: April 19, 2009, 04:35:55 pm »

When I call ShowProgram(1) my application hangs.  I'm wondering if this is a thread affinity issue.  The ShowProgram() call is likely NOT being called on the same thread that the MCAutomationClass object is being created on.

When I call ShowProgram(1) immediately after getting a reference to the COM object, ShowProgram(1) works fine, but when I call it later (from another thread) it locks up.

I tried both of the following and they both result in the ShowProgram() method not returning, and the MC UI locks up (but it will continue to play music).

Code: [Select]
_mediaCenter.ShowProgram(1)

// Also tried:
Type t = _mediaCenter.GetType();
t.InvokeMember("ShowProgram", System.Reflection.BindingFlags.InvokeMethod, null, _mediaCenter, new object[1] { (int)1 });

I an not running this from a windows form, so I can not use Control.Invoke() to tun on the right thread.

Johnny
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: COM Deadlock
« Reply #1 on: April 19, 2009, 04:39:53 pm »

For things that use the user interface, you may not be able to cross thread boundaries.

It would be better for your thread to post a message back to the main thread that does the show.
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up