Instantiate MESSAGEMAN first. (#1399)

This fixes a well-formed warning, but does it break anything?

It's not clear off hand. Having this up for discussion.

(Matt McCutchen <matt@mattmccutchen.net>: Cherry picked from commit
a565a27da8c5278846c06585cb6e218ff8f0f1b7 with a conflict resolution.
This commit fixes a crash on startup in MessageManager::Broadcast when I
build StepMania with -DCMAKE_BUILD_TYPE=Release and g++ 6.3.1 on Fedora
25.  Apparently g++ is optimizing out the "this != NULL" on the grounds
that calling a method on a null pointer has undefined behavior, so the
"m_Logging" is a null dereference.)
This commit is contained in:
Matt McCutchen
2017-02-10 09:40:43 -05:00
committed by Colby Klein
parent d96bcae8de
commit 4b3507f195
2 changed files with 4 additions and 4 deletions
+1 -2
View File
@@ -207,8 +207,7 @@ void MessageManager::Unsubscribe( IMessageSubscriber* pSubscriber, MessageID m )
void MessageManager::Broadcast( Message &msg ) const
{
// GAMESTATE is created before MESSAGEMAN, and has several BroadcastOnChangePtr members, so they all broadcast when they're initialized.
if(this != NULL && m_Logging)
if(m_Logging)
{
LOG->Trace("MESSAGEMAN:Broadcast: %s", msg.GetName().c_str());
}