Author Topic: Bug in MB_GetWindowHandle  (Read 3884 times)

Elberet

  • Full Member
  • ***
  • Posts: 167
Man, it's been ages since I posted in this forum... ^^

Anyhow, I've been toying with the plugin API and I think I found a bug in MB_GetWindowHandle. When this delegate is called e.g. in response to the PluginStartup notification, the call is running on a background thread where MusicBee can't query the main Form's handle:
Code
       bei System.Windows.Forms.Control.get_Handle()
       bei #=qzjQScvhaxDGgseRKuAhV_kELbKEcrC_gcOcNkdsp1mc=.#=qrVSCRWSBIFxMCO4aVHPWuKX_K15AMOs2Pj2p4C4EKR0=()
       bei MusicBeePlugin.MusicBeeAPI.get_MainWindow()
       bei TestPlugin.TestPlugin.OnPluginStartup()

Ah, isn't .NET lovely... ;)

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31969
i expect you would only get that error in debug mode with the crossthreading check enabled in Visual Studio but i've put in some logic to get the info from the GUI thread so it doesnt happen.
I'll post an update link tomorrow

Elberet

  • Full Member
  • ***
  • Posts: 167
Yeah, maybe don't 'fix' the code but write some documentation for the API calls. ;-D


It's unbelieveable how rusty I've become with GUI code and heavy multithreading. Having spent the last year or so exclusively with Java-based lowlevel development (yeah, sounds strange...), I can't quite get my bearings with a huge framework like .NET... ^^;

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31969
fixed in this update (or any weekly update after 29-May-2011 if link is dead):
http://www.mediafire.com/?zpuoouswgja6w0u