Something broke in the tip


#1

I updated JUCE in SimpleDJ to the latest tip and now I get an unhandled exception writing to location 0x01c19bb4 in Atomic::operator++(), when assigning the String from a SettableTooltipClient in response to lookAndFeelChanged (none of this is my code, this is all standard JUCE base class code).

Here’s the SimpleDJ project:

https://github.com/vinniefalco/AppletJUCE

Here’s a screenshot of the stack trace:

[attachment=0]Stack.png[/attachment]

I have no idea why this is happening…has there been a recent change?


#2

The last version of JUCE I was using is the one before the Slider was refactored into a pimpl.

Slider::pimpl is 0xcdcdcdcd in the debugger, after executing this line:

[attachment=0]Stack.png[/attachment]


#3

Slider::pimpl is a scopedpointer - the only way it could be 0xcdcdcdcd would be if your slider object is a dangling pointer…


#4

It looks like it becomes 0xcdcdcdcd AFTER the call to operator new, which is puzzling. This is all on startup of the application (during creation of the interface). It used to work, but when I updated JUCE it broke. I don’t understand why this is happening…but it has something to do with the Slider turning into a pimpl.


#5

Perhaps there’s some kind of callback being invoked during the lookandfeel setup which is deleting your slider while it’s still in the middle of initialising itself. I’d stick a breakpoint in the slider destructor and see what happens.


#6

It looks like the 0xcdcdcdcd was just a false reading from the debugger. I assigned pimpl.get() to a local void* and it was 0x00000000, and got correctly initialized after the call to new.

On further analysis, it seems this is causing the failure:

static inline StringHolder* bufferFromText (const CharPointerType& text) noexcept { // (Can't use offsetof() here because of warnings about this not being a POD) return reinterpret_cast <StringHolder*> (reinterpret_cast <char*> (text.getAddress()) - (reinterpret_cast <size_t> (reinterpret_cast <StringHolder*> (1)->text) - 1)); }

Jules, I am subclassing Slider.


#7

The call to InterlockedIncrement is failing with access violation. The address in question is 0x01929bb4 (which seems fine). Help!


#8

Sorry, no idea!


#9

Okay I am trying to see if it crashes on the Mac but I am getting link errors (the project is at https://github.com/vinniefalco/AppletJUCE if you want to try it):

Undefined symbols for architecture i386: "non-virtual thunk to juce::Button::getTooltip()", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::setTooltip(juce::String const&)", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::applicationCommandInvoked(juce::ApplicationCommandTarget::InvocationInfo const&)", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::applicationCommandListChanged()", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::valueChanged(juce::Value&)", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::keyPressed(juce::KeyPress const&, juce::Component*)", referenced from: vtable for CParamToggleButton in CParamToggleButton.o "non-virtual thunk to juce::Button::keyStateChanged(bool, juce::Component*)", referenced from: vtable for CParamToggleButton in CParamToggleButton.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Interestingly, the getTooltip() function is on the stack when it crashes on launch (Windows).

How do I fix these link errors?


#10

Are you including the headers from one version + compiling the source from another?


#11

Definitely not because the only JUCE directory is the one in the repository. I think…I’m not completely sure to be honest.

Actually I am sure, because the “Module source folder” and the “local JUCE folder” for each of the exporters, all have the same value. They point into “…Extern/JUCE/modules”, which is here:

https://github.com/vinniefalco/AppletJUCE/tree/master/Extern


#12

Well, I don’t know, but that all looks like a mis-matched link to me…


#13

If I change CParamToggleButton (my class) to not derive from juce::Button or juce::TextButton, the link error goes away and the app runs (but the button of course does not appear).

I’m also seeing another problem where the leak detector complains about a double delete of a File object, with the call stack having something to do with asking the WebKit framework for a standard cursor PNG?


#14

Vinnie, did you import this project from one version of VS to another? The reason I ask is that I attempted to port our 1.4 JUCE code to 2.0, and I ran into a very similar issue regarding my subclassing of Slider. I never solved the issue, and I had to give up on the task (as the priority of others things took precedent). The only other moving piece in my attempt was that I had upgraded from VS2005 to VS 2010 (or 2012, I can’t recall), and just imported the old project. So, I was planning on rebuilding the project in the new VS, and see if that helped.


#15

Well this is failing in Xcode. Under Visual Studio I get a crash on launch which has proven impossible for me to decipher.