Index: mptrack/mod2midi.cpp
===================================================================
--- mptrack/mod2midi.cpp	(revision 18727)
+++ mptrack/mod2midi.cpp	(working copy)
@@ -456,6 +456,7 @@
 
 			m_tracks.reserve(m_sndFile.GetNumInstruments() + 1);
 			MidiTrack &tempoTrack = *(new MidiTrack(m_plugFactory, m_sndFile, m_songLength, tempoTrackPlugin, nullptr, mpt::ToUnicode(m_sndFile.GetCharsetInternal(), m_sndFile.m_songName), nullptr, overlappingInstruments));
+			tempoTrackPlugin.pMixPlugin = &tempoTrack;
 			tempoTrack.WriteString(kText, mpt::ToUnicode(m_sndFile.GetCharsetInternal(), m_sndFile.m_songMessage.GetString()));
 			tempoTrack.WriteString(kCopyright, m_sndFile.m_songArtist);
 			m_tracks.push_back(&tempoTrack);
Index: soundlib/plugins/PluginManager.cpp
===================================================================
--- soundlib/plugins/PluginManager.cpp	(revision 18727)
+++ soundlib/plugins/PluginManager.cpp	(working copy)
@@ -737,6 +737,8 @@
 		{
 			pFound->InsertPluginInstanceIntoList(*plugin);
 		}
+		CriticalSection cs;
+		mixPlugin.pMixPlugin = plugin;
 		return plugin != nullptr;
 	}
 
@@ -785,8 +787,6 @@
 
 		if(pEffect != nullptr && pEffect->dispatcher != nullptr && pEffect->magic == Vst::kEffectMagic)
 		{
-			validPlugin = true;
-
 			GetPluginInformation(maskCrashes, pEffect, *pFound);
 
 			// Update cached information
@@ -797,10 +797,9 @@
 			{
 				pFound->InsertPluginInstanceIntoList(*pVstPlug);
 			}
-			if(pVstPlug == nullptr)
-			{
-				validPlugin = false;
-			}
+			validPlugin = (pVstPlug != nullptr);
+			CriticalSection cs;
+			mixPlugin.pMixPlugin = pVstPlug;
 		}
 
 		if(!validPlugin)
Index: soundlib/plugins/PlugInterface.cpp
===================================================================
--- soundlib/plugins/PlugInterface.cpp	(revision 18727)
+++ soundlib/plugins/PlugInterface.cpp	(working copy)
@@ -54,7 +54,6 @@
 	, m_pMixStruct(&mixStruct)
 {
 	m_SndFile.m_loadedPlugins++;
-	m_pMixStruct->pMixPlugin = this;
 	m_MixState.pMixBuffer = mpt::align_bytes<8, MIXBUFFERSIZE * 2>(m_MixBuffer);
 	while(m_pMixStruct != &(m_SndFile.m_MixPlugins[m_nSlot]) && m_nSlot < MAX_MIXPLUGINS - 1)
 	{
