Thursday, August 27, 2015

ImfPreview Bug: Re-registered Event Handler

For quite a while, I have been occasionally experiencing a strange issue with ImfPreview: right-clicking songs in Music Mappings (to play them) sometimes results in the player dialog reopening once or a few times after it is closed. Only recently did I pinpoint the problem.

When the Music Mappings dialog is opened, ImfPreview hooks the songs list's MouseClick event and adds a handler that converts the IMF and plays it. The problem is that the handler is added every time the dialog is opened, so the dialog appears once for every time the user has opened Music Mappings after starting Abiathar.

The fix will be to check whether the dialog-opening code has already run and skip the AddHandler if it has.

No comments:

Post a Comment