musescore/MuseScore — pull request #1495 by trig-ger (2014-12-01 14:18:40+00:00)
Title: Fix duplicate score tabs and recent files list for MIDI import

I. Fix for the bug with duplicate score tabs:
1) open a MIDI file
2) click 'Apply' button in the MIDI import panel - duplicate of the page opens
3) close previous, currently inactive tab -> crash

II. Fix bug with empty recent files list for MIDI files:
1) open a MIDI file
2) close it -> no file was added to the recent files list in the MuseScore menu

III. Fix duplicate score name in saved file template:
1) open a MIDI file
2) save -> in the filesave dialog there is an extension duplicate

IV. Fix for empty last score file:
1) open a MIDI file
2) save -> before the file become actually saved on disk it is added to the recent files list,
where canonicalFilePath is called to determine this file name. It returns "" if file is not exist

V. Fix last session load:
1) open a MIDI file
2) open some score (mscz) file and edit it, but don't save
3) kill MuseScore process
4) run again and restore last session -> MIDI file is interpreted as mscz file and treated as not found

This are regression fixes concerning MIDI import,
appeared after https://github.com/musescore/MuseScore/commit/e4b19ffcf9638a6f4ab3fe31e6f2972f98bacf03
There can be more similar bugs.
Previous pull request that stared this series of fixes: https://github.com/musescore/MuseScore/pull/1423

Now what seems also strange is that MIDI file is added to the recent list right after it is opened,
but the opened score file is added only after its close. Not sure, is it important.