Introjucer crash (latest tip) maybe because indexOfSorted


#1

when saving a projects

the problem that the second parameter of compare is a nullptr

First-chance exception at 0x00d4c60f in Introjucer.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00d4c60f in Introjucer.exe: 0xC0000005: Access violation reading location 0x00000000.

 	Introjucer.exe!juce::ReferenceCountedObjectPtr<juce::ValueTree::SharedObject>::operator juce::ValueTree::SharedObject *()  Line 319 + 0x3 bytes	C++
 	Introjucer.exe!juce::ValueTree::getType()  Line 717 + 0x8 bytes	C++
 	Introjucer.exe!XCodeProjectExporter::compareElements(const juce::ValueTree * first=0x05360a60, const juce::ValueTree * second=0x00000000)  Line 916 + 0x10 bytes	C++
>	Introjucer.exe!juce::OwnedArray<juce::ValueTree,juce::DummyCriticalSection>::indexOfSorted<XCodeProjectExporter const ,juce::ScopedPointer<juce::ValueTree> >(const XCodeProjectExporter & comparator={...}, juce::ScopedPointer<juce::ValueTree> objectToLookFor={...})  Line 483 + 0x1d bytes	C++
 	Introjucer.exe!XCodeProjectExporter::addFileReference(juce::String pathString={...})  Line 898 + 0x27 bytes	C++
 	Introjucer.exe!XCodeProjectExporter::addFramework(const juce::String & frameworkName={...})  Line 999 + 0x24 bytes	C++
 	Introjucer.exe!XCodeProjectExporter::addFrameworks()  Line 777 + 0x15 bytes	C++
 	Introjucer.exe!XCodeProjectExporter::createObjects()  Line 288	C++
 	Introjucer.exe!XCodeProjectExporter::create(const juce::OwnedArray<LibraryModule,juce::DummyCriticalSection> & __formal={...})  Line 160	C++
 	Introjucer.exe!ProjectSaver::ExporterJob::runJob()  Line 543	C++
 	Introjucer.exe!juce::ThreadPool::runNextJob()  Line 339 + 0xd bytes	C++
 	Introjucer.exe!juce::ThreadPool::ThreadPoolThread::run()  Line 71 + 0xb bytes	C++
 	Introjucer.exe!juce::Thread::threadEntryPoint()  Line 98	C++
 	Introjucer.exe!juce::juce_threadEntryPoint(void * userData=0x05233c18)  Line 106	C++
 	Introjucer.exe!juce::threadEntryProc(void * userData=0x05233c18)  Line 119 + 0x9 bytes	C++
 	Introjucer.exe!_callthreadstartex()  Line 348 + 0xf bytes	C
 	Introjucer.exe!_threadstartex(void * ptd=0x0527bde8)  Line 331	C

#2

Gah… It’s those template changes that Vinnie suggested for the array comparator methods. I had a nagging feeling that they might break something, but couldn’t think of an example… In fact, passing a ScopedPointer as one of the parameters is the problem, as it’ll make a temporary copy of the scopedpointer, which will clear the original. I’ll roll back that change, as this could bite other people too.