Can't start app after GIT update


#1

Today I did a GIT update and I had to do the Image and popup menu changes to get my plugin compiled.
But as soon as it gets started I got a windows triggered breakpoint here:

MessageListener::MessageListener() throw()
{
	// are you trying to create a messagelistener before or after juce has been intialised??
	jassert (MessageManager::instance != 0);

	if (MessageManager::instance != 0)
		MessageManager::instance->messageListeners.add (this);
}

I would like to debug but it doesn’t matter where ever I set a debug point, I never reach him becaus of the
problem above.

Could somebody please tell me where to start debugging or any idea what could go wrong?
Again, I only did the Image and Popup menu changes.


#2

Do you use a static Value ?


#3

I do use lots of static const values to make the code more readable but I guess you mean
something different?


#4

No, if you’re using a static juce::Value class, then it’ll assert on starting. Juce is made so that you can’t do anything serious out of App::initialise and App::shutdown.
If you’re using a static (or global) Value, change the code from :

namespace juce
{
    // Don't do that
    Value a(0);
    static Value b(0);


    // But this instead:
    Value & getA() { static Value a(0); return a; }
    Value & getB() { static Value b(0); return b; }
}

This will only work, if the class using such Value are created after initialise is called.


#5

Thanks Cyril.

It’s a good idea to wrap all your more complex static objects in functions like that anyway, because if you just let the compiler decide the order in which to instantiate them, you can hit all sorts of nasty problems.


#6

No, there a no juce::Value involved at all in my code!


#7

Well surely you can just look at the stack trace when it hits this, and see what type of object it is that you’re creating statically?


#8

Found it,

I did compile most of the images I use in my plugin statically using ImageCache.
That did mess everything up.

You probaly will tell me that this is bad design but it worked and it was already on my list to change.

Thank you!
Joerg