getmusicbee.com

Support => Developers' Area => MusicBee API => Topic started by: Elberet on May 28, 2011, 09:25:13 PM

Title: Bug in MB_GetWindowHandle
Post by: Elberet on May 28, 2011, 09:25:13 PM
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... ;)
Title: Re: Bug in MB_GetWindowHandle
Post by: Steven on May 28, 2011, 10:02:18 PM
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
Title: Re: Bug in MB_GetWindowHandle
Post by: Elberet on May 29, 2011, 01:19:05 AM
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... ^^;
Title: Re: Bug in MB_GetWindowHandle
Post by: Steven on May 29, 2011, 10:39:49 AM
fixed in this update (or any weekly update after 29-May-2011 if link is dead):
http://www.mediafire.com/?zpuoouswgja6w0u