Using Juce in a 64 bit VST plugin


#1

Hello,

I’m using some of the juce classes from my VST plugin (VSTSDK2.4 VSTGUI4.0) on Mac. Cocoa based.
When I load my plugin in Cubase 6.0 in 64 bit mode, I get a crash:

[code]Process: Cubase 6 [7270]
Path: /Applications/Cubase 6.app/Contents/MacOS/Cubase 6
Identifier: com.steinberg.cubase
Version: 6.0.0.229 (6.0.0.229)
Code Type: X86-64 (Native)
Parent Process: launchd [189]

Date/Time: 2011-10-19 11:34:11.360 +0200
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6

Interval Since Last Report: 112364 sec
Crashes Since Last Report: 34
Per-App Interval Since Last Report: 486 sec
Per-App Crashes Since Last Report: 2
Anonymous UUID: 16B7315C-82FC-4449-B960-4DA34A3CE4E1

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Application Specific Information:
*** error for object 0x110105100: incorrect checksum for freed object - object was probably modified after being freed.

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff80e470b6 __kill + 10
1 libSystem.B.dylib 0x00007fff80ee79f6 abort + 83
2 libSystem.B.dylib 0x00007fff80ed662d szone_error + 519
3 libSystem.B.dylib 0x00007fff80dffb20 szone_free_definite_size + 1639
4 com.apple.Foundation 0x00007fff8a37a2c7 _attributesAtPath + 624
5 com.apple.Foundation 0x00007fff8a379f76 +[NSFileAttributes _attributesAtPath:partialReturn:filterResourceFork:error:] + 1124
6 com.apple.Foundation 0x00007fff8a3d712e -[NSFileManager enumeratorAtPath:] + 36
7 com.my-company.plugin.VST 0x0000000110a69abe juce::DirectoryIterator::NativeIterator::Pimpl::Pimpl(juce::File const&, juce::String const&) + 120
8 com.my-company.plugin.VST 0x0000000110a5c718 juce::DirectoryIterator::NativeIterator::NativeIterator(juce::File const&, juce::String const&) + 60
9 com.my-company.plugin.VST 0x0000000110a36cc4 juce::DirectoryIterator::DirectoryIterator(juce::File const&, bool, juce::String const&, int) + 98[/code]

In the 32-bit version of Cubase I don’t have that issue. I’m am thinking of a Juce vs. Cocoa problem maybe?

It is apparently caused by a call from the constructor of my plguin DirectoryIterator iter (defaultPathFile, false, “*.my_extention”);
The crash does not occur in al hosts.

I’m trying to figure out what causes this issue, but had no success until now.
Maybe someone had a similar issue?

Gilles


#2

That’s a complete mystery to me! It looks like Cocoa is crashing internally, which is very peculiar…


#3

A betatester of mine has a similar problem with Audio Unit on Logic Pro 9.1.1

Process:         Logic Pro [145]
Path:            /Applications/Logic Pro.app/Contents/MacOS/Logic Pro
Identifier:      com.apple.logic.pro
Version:         9.1.1 (1697.53)
Build Info:      Logic-16975300~1
Code Type:       X86-64 (Native)
Parent Process:  launchd [91]

PlugIn Path:       /Users/peter/Library/Audio/Plug-Ins/Components/SWAM_SaxS_x64.component/Contents/MacOS/SWAM_SaxS_x64
PlugIn Identifier: com.swam-engine.SWAM_SaxS_x64
PlugIn Version:    1.1 ()

Date/Time:       2011-10-26 18:14:02.409 +0200
OS Version:      Mac OS X 10.6.4 (10F569)
Report Version:  6

Interval Since Last Report:          318985 sec
Crashes Since Last Report:           5
Per-App Interval Since Last Report:  29660 sec
Per-App Crashes Since Last Report:   4
Anonymous UUID:                      49FEE4F0-69F5-47CD-8778-C89E72321747

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  6

Application Specific Information:
*** error for object 0x104927bc0: incorrect checksum for freed object - object was probably modified after being freed.


Thread 0:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             	0x00007fffffe00295 __spin_lock + 53
1   libobjc.A.dylib               	0x00007fff88bc22a2 unmap_image + 131
2   dyld                          	0x00007fff5fc04a34 dyld::removeImage(ImageLoader*) + 300
3   dyld                          	0x00007fff5fc04ba5 dyld::garbageCollectImages() + 65
4   dyld                          	0x00007fff5fc09e9a dlclose + 130
5   libSystem.B.dylib             	0x00007fff874f1ae5 dlclose + 69
6   com.apple.CoreFoundation      	0x00007fff84816b39 _CFBundleDlfcnUnload + 41
7   com.apple.CoreFoundation      	0x00007fff847abcd4 CFBundleUnloadExecutable + 532
8   com.apple.logic.pro           	0x0000000100533900 std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> >::insert(__gnu_cxx::__normal_iterator<CMDAudioUnit::SIOConfig*, std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> > >, CMDAudioUnit::SIOConfig const&) + 38608
9   com.apple.logic.pro           	0x0000000100533958 std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> >::insert(__gnu_cxx::__normal_iterator<CMDAudioUnit::SIOConfig*, std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> > >, CMDAudioUnit::SIOConfig const&) + 38696
10  com.apple.logic.pro           	0x000000010039a17e std::_Rb_tree<short, std::pair<short const, CGRect>, std::_Select1st<std::pair<short const, CGRect> >, std::less<short>, std::allocator<std::pair<short const, CGRect> > >::_M_erase(std::_Rb_tree_node<std::pair<short const, CGRect> >*) + 96942
11  com.apple.logic.pro           	0x000000010039a2d6 std::_Rb_tree<short, std::pair<short const, CGRect>, std::_Select1st<std::pair<short const, CGRect> >, std::less<short>, std::allocator<std::pair<short const, CGRect> > >::_M_erase(std::_Rb_tree_node<std::pair<short const, CGRect> >*) + 97286
12  libSystem.B.dylib             	0x00007fff8754a35a _sigtramp + 26
13  ???                           	0x00007fff5fbfccc0 0 + 140734799793344
14  com.apple.CoreGraphics        	0x00007fff81767754 _CGSSynchronizeWindowBackingStore + 97
15  com.apple.CoreGraphics        	0x00007fff8174d2a9 _CGSLockWindow + 4515
16  com.apple.CoreGraphics        	0x00007fff81753e3f CGSDeviceLock + 535
17  libRIP.A.dylib                	0x00007fff80f49e43 ripd_Lock + 46
18  libRIP.A.dylib                	0x00007fff80f501c2 ripl_BltImage + 294
19  libRIP.A.dylib                	0x00007fff80f4fe29 ripc_RenderImage + 323
20  libRIP.A.dylib                	0x00007fff80f4df5c ripc_DrawImage + 2411
21  com.apple.CoreGraphics        	0x00007fff8178a11a CGContextDrawImage + 446
22  com.apple.logic.pro           	0x00000001006d828f CSeqEvHdr_Templ<CEvMarker, (TSeqEvHdrType)3, CEv, CEv, std::allocator<CEvMarker> >::EvValidAt(TSignedPureClock) + 38159
23  com.apple.logic.pro           	0x00000001004f938d std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 187805
24  com.apple.logic.pro           	0x00000001007569ed std::vector<SurvivingEvent, std::allocator<SurvivingEvent> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SurvivingEvent*, std::vector<SurvivingEvent, std::allocator<SurvivingEvent> > >, SurvivingEvent const&) + 50317
25  com.apple.logic.pro           	0x0000000100757343 std::vector<SurvivingEvent, std::allocator<SurvivingEvent> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SurvivingEvent*, std::vector<SurvivingEvent, std::allocator<SurvivingEvent> > >, SurvivingEvent const&) + 52707
26  com.apple.logic.pro           	0x00000001000c6252 LowLevelMovieSync(long, long) + 63458
27  com.apple.logic.pro           	0x00000001000c7057 LowLevelMovieSync(long, long) + 67047
28  com.apple.logic.pro           	0x0000000100327d6e std::list<MEGAPARS, std::allocator<MEGAPARS> >::sort() + 180318
29  com.apple.logic.pro           	0x000000010032ef70 std::list<MEGAPARS, std::allocator<MEGAPARS> >::sort() + 209504
30  com.apple.logic.pro           	0x0000000100330851 std::list<MEGAPARS, std::allocator<MEGAPARS> >::sort() + 215873
31  com.apple.logic.pro           	0x00000001004f38d8 std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 164584
32  com.apple.logic.pro           	0x000000010050874e std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 250206
33  com.apple.logic.pro           	0x0000000100505b0c std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 238876
34  com.apple.logic.pro           	0x00000001001aa0ff std::_List_base<PMName, std::allocator<PMName> >::_M_clear() + 43119
35  com.apple.logic.pro           	0x00000001005bb8ea std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> >::insert(__gnu_cxx::__normal_iterator<CMDAudioUnit::SIOConfig*, std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> > >, CMDAudioUnit::SIOConfig const&) + 595642
36  com.apple.logic.pro           	0x00000001001a83a1 std::_List_base<PMName, std::allocator<PMName> >::_M_clear() + 35601
37  com.apple.logic.pro           	0x000000010050df07 std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 272663
38  com.apple.logic.pro           	0x00000001004fc45a std::vector<unsigned int, std::allocator<unsigned int> >::reserve(unsigned long) + 200298
39  com.apple.logic.pro           	0x00000001001aa94d std::_List_base<PMName, std::allocator<PMName> >::_M_clear() + 45245
40  com.apple.logic.pro           	0x00000001005bc5df std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> >::insert(__gnu_cxx::__normal_iterator<CMDAudioUnit::SIOConfig*, std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> > >, CMDAudioUnit::SIOConfig const&) + 598959
41  com.apple.logic.pro           	0x00000001001adfb8 std::_List_base<PMName, std::allocator<PMName> >::_M_clear() + 59176
42  com.apple.logic.pro           	0x00000001005a05fd std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> >::insert(__gnu_cxx::__normal_iterator<CMDAudioUnit::SIOConfig*, std::vector<CMDAudioUnit::SIOConfig, std::allocator<CMDAudioUnit::SIOConfig> > >, CMDAudioUnit::SIOConfig const&) + 484301
43  com.apple.Foundation          	0x00007fff83ddfa2d __NSFireTimer + 114
44  com.apple.CoreFoundation      	0x00007fff84790678 __CFRunLoopRun + 6488
45  com.apple.CoreFoundation      	0x00007fff8478e84f CFRunLoopRunSpecific + 575
46  com.apple.HIToolbox           	0x00007fff856ee91a RunCurrentEventLoopInMode + 333
47  com.apple.HIToolbox           	0x00007fff856ee71f ReceiveNextEventCommon + 310
48  com.apple.HIToolbox           	0x00007fff856ee5d8 BlockUntilNextEventMatchingListInMode + 59
49  com.apple.AppKit              	0x00007fff85c9529e _DPSNextEvent + 708
50  com.apple.AppKit              	0x00007fff85c94bed -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
51  com.apple.AppKit              	0x00007fff85c5a8d3 -[NSApplication run] + 395
52  com.apple.prokit              	0x00000001011c58a6 NSProApplicationMain + 268
53  com.apple.logic.pro           	0x0000000100029d38 DummyConnection::DummyConnection() + 86

#4

This happened building the AU plugin in Debug mode; we are using Juce 1.53:

Process:         Logic Pro [187]
Path:            /Applications/Logic Pro.app/Contents/MacOS/Logic Pro
Identifier:      com.apple.logic.pro
Version:         9.1.1 (1697.53)
Build Info:      Logic-16975300~1
Code Type:       X86-64 (Native)
Parent Process:  launchd [101]

Date/Time:       2011-10-27 09:26:31.409 +0200
OS Version:      Mac OS X 10.6.4 (10F569)
Report Version:  6

Interval Since Last Report:          326671 sec
Crashes Since Last Report:           8
Per-App Interval Since Last Report:  35855 sec
Per-App Crashes Since Last Report:   7
Anonymous UUID:                      49FEE4F0-69F5-47CD-8778-C89E72321747

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: 0x000000000000000d, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             	0x00007fff875383d6 __kill + 10
1   libSystem.B.dylib             	0x00007fff875d8913 __abort + 103
2   libSystem.B.dylib             	0x00007fff875d8981 abort_report_np + 0
3   com.apple.logic.pro           	0x000000010039a486 std::_Rb_tree<short, std::pair<short const, CGRect>, std::_Select1st<std::pair<short const, CGRect> >, std::less<short>, std::allocator<std::pair<short const, CGRect> > >::_M_erase(std::_Rb_tree_node<std::pair<short const, CGRect> >*) + 97718
4   libSystem.B.dylib             	0x00007fff8754a35a _sigtramp + 26
5   ???                           	0x00007fff5fbfe890 0 + 140734799800464
6   com.apple.CoreFoundation      	0x00007fff847b3077 __CFRunLoopDoObservers + 519
7   com.apple.CoreFoundation      	0x00007fff8478f0cf __CFRunLoopRun + 943
8   com.apple.CoreFoundation      	0x00007fff8478e84f CFRunLoopRunSpecific + 575
9   com.apple.HIToolbox           	0x00007fff856ee91a RunCurrentEventLoopInMode + 333
10  com.apple.HIToolbox           	0x00007fff856ee71f ReceiveNextEventCommon + 310
11  com.apple.HIToolbox           	0x00007fff856ee5d8 BlockUntilNextEventMatchingListInMode + 59
12  com.apple.AppKit              	0x00007fff85c9529e _DPSNextEvent + 708
13  com.apple.AppKit              	0x00007fff85c94bed -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
14  com.apple.AppKit              	0x00007fff85c5a8d3 -[NSApplication run] + 395
15  com.apple.prokit              	0x00000001011c58a6 NSProApplicationMain + 268
16  com.apple.logic.pro           	0x0000000100029d38 DummyConnection::DummyConnection() + 86

#5

Well… since none of the plugin’s code appears anywhere in the stack trace, that doesn’t really help much!


#6

Hi all, finally I solved; was my mistake (and not good coding :frowning: )
I had two pointers pointing to the same object, when I released the object I put only one of the two pointers to 0.
Then in another point of the code I use the object if the second pointer is not 0, but of course the object does not exist anymore.