Juce demo crash


#1

Hi,

I only tested this on Windows XP.
Go to “Treeviews”, click on “Type of treeview…”, select “FileTreeComponent…” and now click on “Show root item” several times and it will crash.
I’ve compiled the Juce demo with the latest sources and it crashes with just one click on “Show root item”, but running the precompiled exe from sourceforge it crashes after several clicks (and sometimes when you try to close de app after repeat this clicks a number of times).

Cheers


#2

I can’t reproduce this… Got a stack trace?


#3

HEAP[JuceDemo.exe]: Heap block at 01FA5EF8 modified at 01FA5F38 past requested size of 38
Windows has triggered a breakpoint in JuceDemo.exe.
This may be due to a corruption of the heap, which indicates a bug in JuceDemo.exe or any of the DLLs it has loaded.

Break point in juce_String.cpp line 163.

Assertions:

[attachment=0]jucedemo.jpg[/attachment]


#4

I’m flattered that you think I can figure it out from that… Any chance of an actual stack trace?


#5

Sorry, I forgot to paste it in my last post. :shock:
I think that the problem is related with the string “C:”. Right now I ran it to copy the call stack and I’ve seen that where the program should write “C:” it wrote “750” just before the crash.
Here is the stack trace:

ntdll.dll!7c91120e() 	
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
ntdll.dll!7c97c201() 	
ntdll.dll!7c959622() 	
ntdll.dll!7c97cf68() 	
ntdll.dll!7c959564() 	
ntdll.dll!7c928f01() 	
ntdll.dll!7c97d144() 	
ntdll.dll!7c959564() 	
ntdll.dll!7c928f01() 	
ntdll.dll!7c9201bb() 	
ntdll.dll!7c9292ef() 	
ntdll.dll!7c97d144() 	
JuceDemo.exe!_heap_alloc_base(unsigned int size=48)  Line 105 + 0x28 bytes	C
JuceDemo.exe!_heap_alloc_dbg_impl(unsigned int nSize=12, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int * errno_tmp=0x0012edf4)  Line 427 + 0x9 bytes	C++
JuceDemo.exe!_nh_malloc_dbg_impl(unsigned int nSize=12, int nhFlag=0, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int * errno_tmp=0x0012edf4)  Line 239 + 0x19 bytes	C++
JuceDemo.exe!_nh_malloc_dbg(unsigned int nSize=12, int nhFlag=0, int nBlockUse=1, const char * szFileName=0x00000000, int nLine=0)  Line 296 + 0x1d bytes	C++
JuceDemo.exe!malloc(unsigned int nSize=12)  Line 56 + 0x15 bytes	C++
JuceDemo.exe!operator new(unsigned int size=12)  Line 59 + 0x9 bytes	C++

JuceDemo.exe!juce::WeakReferencejuce::Component,juce::ReferenceCountedObject::Master::operator()(juce::Component * const object=0x01fc6e18) Line 175 + 0x7 bytes C++
JuceDemo.exe!juce::Component::getWeakReference() Line 447 C++
JuceDemo.exe!juce::WeakReferencejuce::Component,juce::ReferenceCountedObject::WeakReferencejuce::Component,juce::ReferenceCountedObject(juce::Component * const object=0x01fc6e18) Line 21616 + 0x40 bytes C++
JuceDemo.exe!juce::Component::setVisible(bool shouldBeVisible=true) Line 487 + 0xc bytes C++
JuceDemo.exe!juce::Component::addAndMakeVisible(juce::Component * const child=0x01fc6e18, int zOrder=-1) Line 1367 C++
JuceDemo.exe!juce::PopupMenu::ItemComponent::ItemComponent(const juce::PopupMenu::Item & itemInfo_={…}, int standardItemHeight=0, juce::Component * const parent=0x01ff5028) Line 147 C++
JuceDemo.exe!juce::PopupMenu::Window::Window(const juce::PopupMenu & menu={…}, juce::PopupMenu::Window * const owner_=0x00000000, const juce::Rectangle & target={…}, const bool alignToRectangle=true, const int itemIdThatMustBeVisible=0, const int minimumWidth_=0, const int maximumNumColumns_=7, const int standardItemHeight_=0, const bool dismissOnMouseUp_=true, juce::ApplicationCommandManager * * const managerOfChosenCommand_=0x01fa13fc, juce::Component * const componentAttachedTo_=0x01f7efa4) Line 286 + 0x3d bytes C++
JuceDemo.exe!juce::PopupMenu::Window::create(const juce::PopupMenu & menu={…}, bool dismissOnMouseUp=true, juce::PopupMenu::Window * const owner_=0x00000000, const juce::Rectangle & target={…}, int minimumWidth=0, int maximumNumColumns=7, int standardItemHeight=0, bool alignToRectangle=true, int itemIdThatMustBeVisible=0, juce::ApplicationCommandManager * * managerOfChosenCommand=0x01fa13fc, juce::Component * componentAttachedTo=0x01f7efa4) Line 332 + 0x53 bytes C++
JuceDemo.exe!juce::PopupMenu::createWindow(const juce::PopupMenu::Options & options={…}, juce::ApplicationCommandManager * * managerOfChosenCommand=0x01fa13fc) Line 1455 + 0x79 bytes C++
JuceDemo.exe!juce::PopupMenu::showWithOptionalCallback(const juce::PopupMenu::Options & options={…}, juce::ModalComponentManager::Callback * const userCallback=0x01fc1940, const bool canBeModal=false) Line 1508 + 0x18 bytes C++
JuceDemo.exe!juce::PopupMenu::showMenuAsync(const juce::PopupMenu::Options & options={…}, juce::ModalComponentManager::Callback * userCallback=0x01fc1940) Line 1543 C++
JuceDemo.exe!TreeViewDemo::buttonClicked(juce::Button * __formal=0x01f7efa4) Line 216 + 0x79 bytes C++
JuceDemo.exe!juce::ListenerList<juce::Button::Listener,juce::Array<juce::Button::Listener *,juce::DummyCriticalSection> >::callChecked<juce::Component::BailOutChecker,juce::Button *>(const juce::Component::BailOutChecker & bailOutChecker={…}, void (juce::Button ) callbackFunction=0x006a7746, juce::Button * param1=0x01f7efa4) Line 181 + 0x11 bytes C++
JuceDemo.exe!juce::Button::sendClickMessage(const juce::ModifierKeys & modifiers={…}) Line 385 C++
JuceDemo.exe!juce::Button::internalClickCallback(const juce::ModifierKeys & modifiers={…}) Line 326 C++
JuceDemo.exe!juce::Button::mouseDown(const juce::MouseEvent & e={…}) Line 432 C++
JuceDemo.exe!juce::Component::internalMouseDown(juce::MouseInputSource & source={…}, const juce::Point & relativePos={…}, const juce::Time & time={…}) Line 2427 C++
JuceDemo.exe!juce::MouseInputSourceInternal::sendMouseDown(juce::Component * const comp=0x01f7efa4, const juce::Point & screenPos={…}, const juce::Time & time={…}) Line 122 + 0x39 bytes C++
JuceDemo.exe!juce::MouseInputSourceInternal::setButtons(const juce::Point & screenPos={…}, const juce::Time & time={…}, const juce::ModifierKeys & newButtonState={…}) Line 191 C++
JuceDemo.exe!juce::MouseInputSourceInternal::handleEvent(juce::ComponentPeer * const newPeer=0x01da7018, const juce::Point & positionWithinPeer={…}, const juce::Time & time={…}, const juce::ModifierKeys & newMods={…}) Line 288 + 0x14 bytes C++
JuceDemo.exe!juce::MouseInputSource::handleEvent(juce::ComponentPeer * peer=0x01da7018, const juce::Point & positionWithinPeer={…}, const int64 time=1314839677670, const juce::ModifierKeys & mods={…}) Line 537 + 0x48 bytes C++
JuceDemo.exe!juce::ComponentPeer::handleMouseEvent(const int touchIndex=0, const juce::Point & positionWithinPeer={…}, const juce::ModifierKeys & newMods={…}, const int64 time=1314839677670) Line 108 C++
JuceDemo.exe!juce::Win32ComponentPeer::doMouseEvent(const juce::Point & position={…}) Line 1381 C++
JuceDemo.exe!juce::Win32ComponentPeer::doMouseDown(const juce::Point & position={…}, const unsigned int wParam=1) Line 1475 C++
JuceDemo.exe!juce::Win32ComponentPeer::peerWindowProc(HWND
* h=0x000503fa, unsigned int message=513, unsigned int wParam=1, long lParam=4980796) Line 2034 + 0x36 bytes C++
JuceDemo.exe!juce::Win32ComponentPeer::windowProc(HWND
* h=0x000503fa, unsigned int message=513, unsigned int wParam=1, long lParam=4980796) Line 1956 + 0x18 bytes C++
user32.dll!7e398734()
user32.dll!7e398816()
user32.dll!7e3989cd()
user32.dll!7e398a10()
JuceDemo.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(const bool returnIfNoPendingMessages=false) Line 206 C++
JuceDemo.exe!juce::MessageManager::runDispatchLoopUntil(int millisecondsToRunFor=-1) Line 153 + 0x10 bytes C++
JuceDemo.exe!juce::MessageManager::runDispatchLoop() Line 134 C++
JuceDemo.exe!juce::JUCEApplication::main(const juce::String & commandLine={…}) Line 241 C++
JuceDemo.exe!WinMain(int __formal=4194304, int __formal=4194304, int __formal=4194304, int __formal=4194304) Line 160 + 0x54 bytes C++
JuceDemo.exe!__tmainCRTStartup() Line 263 + 0x2c bytes C
JuceDemo.exe!WinMainCRTStartup() Line 182 C
kernel32.dll!7c817067()

Another run, and a different stack trace:

ntdll.dll!7c91120e() 	
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
ntdll.dll!7c97c201() 	
ntdll.dll!7c959705() 	
ntdll.dll!7c937553() 	

JuceDemo.exe!juce::Component::internalRepaint(int x=10, int y=40, int w=672, int h=492) Line 1793 C++
JuceDemo.exe!juce::Component::internalRepaint(int x=10, int y=40, int w=672, int h=-1) Line 1793 C++
JuceDemo.exe!juce::Component::internalRepaint(int x=0, int y=32825988, int w=1242884, int h=8148156) Line 1793 C++
JuceDemo.exe!juce::Component::repaint(const int x=1242980, const int y=8621951, const int w=1, const int h=0) Line 1750 C++
01f4e284()
JuceDemo.exe!_ismbblead(unsigned int tst=1245112) Line 172 + 0xf bytes C++

Another one…

JuceDemo.exe!juce::EdgeTable::EdgeTable(const juce::Rectangle & bounds_={…}, const juce::Path & path={…}, const juce::AffineTransform & transform={…}) Line 50 + 0x3 bytes C++
JuceDemo.exe!juce::SoftwareRendererClasses::ClipRegion_EdgeTable::clipToPath(const juce::Path & p={…}, const juce::AffineTransform & transform={…}) Line 1264 + 0x1c bytes C++
JuceDemo.exe!juce::SoftwareRendererClasses::ClipRegion_RectangleList::clipToPath(const juce::Path & p={…}, const juce::AffineTransform & transform={…}) Line 1464 + 0x7f bytes C++
JuceDemo.exe!juce::LowLevelGraphicsSoftwareRenderer::SavedState::renderImage(const juce::Image & sourceImage={…}, const juce::AffineTransform & t={…}, const juce::SoftwareRendererClasses::ClipRegionBase * const tiledFillClipRegion=0x00000000) Line 2177 + 0x36 bytes C++
JuceDemo.exe!juce::LowLevelGraphicsSoftwareRenderer::drawImage(const juce::Image & sourceImage={…}, const juce::AffineTransform & transform={…}, const bool fillEntireClipAsTiles=false) Line 2369 + 0x6d bytes C++
JuceDemo.exe!juce::Graphics::drawImageTransformed(const juce::Image & imageToDraw={…}, const juce::AffineTransform & transform={…}, const bool fillAlphaChannelWithCurrentBrush=false) Line 711 C++
JuceDemo.exe!juce::Graphics::drawImage(const juce::Image & imageToDraw={…}, int dx=7, int dy=2, int dw=18, int dh=18, int sx=0, int sy=0, int sw=32, int sh=32, const bool fillAlphaChannelWithCurrentBrush=false) Line 689 + 0xfc bytes C++
JuceDemo.exe!juce::Graphics::drawImageWithin(const juce::Image & imageToDraw={…}, const int destX=2, const int destY=2, const int destW=28, const int destH=18, const juce::RectanglePlacement & placementWithinTarget={…}, const bool fillAlphaChannelWithCurrentBrush=false) Line 673 C++
JuceDemo.exe!juce::LookAndFeel::drawFileBrowserRow(juce::Graphics & g={…}, int width=624, int height=22, const juce::String & filename={…}, juce::Image * icon=0x01f88c84, const juce::String & fileSizeDescription={…}, const juce::String & fileTimeDescription={…}, const bool isDirectory=true, const bool isItemSelected=false, const int formal=3, const int formal=3) Line 2656 C++
JuceDemo.exe!juce::FileListTreeItem::paintItem(juce::Graphics & g={…}, int width=624, int height=22) Line 150 + 0xb0 bytes C++
JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g={…}, int width=672) Line 1478 C++
JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g={…}, int width=672) Line 1562 C++
JuceDemo.exe!juce::TreeViewContentComponent::paint(juce::Graphics & g={…}) Line 175 C++
JuceDemo.exe!juce::Component::paintComponent(juce::Graphics & g={…}) Line 1832 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1856 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=false) Line 1946 C++
JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={…}) Line 1838 C++
JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={…}) Line 1902 C++
JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={…}, const bool ignoreAlphaLevel=true) Line 1946 C++
JuceDemo.exe!juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext & contextToPaintTo={…}) Line 130 C++
JuceDemo.exe!juce::Win32ComponentPeer::handlePaintMessage() Line 1361 C++
JuceDemo.exe!juce::Win32ComponentPeer::peerWindowProc(HWND
* h=0x000303fa, unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 2004 C++
JuceDemo.exe!juce::Win32ComponentPeer::windowProc(HWND
* h=0x000303fa, unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 1956 + 0x18 bytes C++
user32.dll!7e398734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!7e398816()
user32.dll!7e3a8ea0()
user32.dll!7e3a8eec()
ntdll.dll!7c91e453()
user32.dll!7e3994d2()
user32.dll!7e3a8f10()
user32.dll!7e398a10()
JuceDemo.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(const bool returnIfNoPendingMessages=false) Line 206 C++
JuceDemo.exe!juce::MessageManager::runDispatchLoopUntil(int millisecondsToRunFor=-1) Line 153 + 0x10 bytes C++
JuceDemo.exe!juce::MessageManager::runDispatchLoop() Line 134 C++
JuceDemo.exe!juce::JUCEApplication::main(const juce::String & commandLine={…}) Line 241 C++
JuceDemo.exe!WinMain(int __formal=4194304, int __formal=4194304, int __formal=4194304, int __formal=4194304) Line 160 + 0x54 bytes C++
JuceDemo.exe!__tmainCRTStartup() Line 263 + 0x2c bytes C
JuceDemo.exe!WinMainCRTStartup() Line 182 C
kernel32.dll!7c817067()


#6

Well, that’s a bit of a mystery - I can’t reproduce it at all, and can’t see any obvious mistakes in the code… It looks like memory corruption, probably something getting double-deleted somewhere, but I can’t see where it could be happening. Is there anything odd about your machine? E.g. do you have loads of drives attached or something?


#7

reminds me a little bit on this issue, where i get a heap corruption with the FileTree too (but i never had problems with release builds so far, so maybe be a false alarm?!)
http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=7488#p42363 (scroll down)
i guess it has something to do with icon (or the way how the icons loaded)

BTW: would be cool to have a file-tree with a native (user-perspective) file structure (Desktop, Workplace etc…), is this maybe possible with Browser or COM-Object…


#8

Yes, the icon loading is the most likely candidate for having a problem, but I looked through the code and can’t see any mistakes in there.


#9

I ran it in two different machines (a Mac Mini and a Clevo laptop with XP Pro SP3), it crashes in both (debug and release). In OS-X it works OK.

Most of the time the root icon “C:” is not correct, it shows the icon assigned to unknown files instead of the open folder icon. See capture:

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


#10

Well, for sure the bug was introduced in version 1.53.
I’ve downloaded the prebuild versions 1.53 and 1.52 of jucedemo, the version 1.52 always shows an “unknown file” icon in the root but it doesn’t crash, it works OK. The 1.53 version crashes.


#11

Thanks, I’ve got it to happen on an old machine, I’ll see what I can figure out…


#12

Well, it was a really subtle problem with a win32 function call overwriting a string, which I guess must have only happened in XP… I’ve checked in a fix on the new modules branch,

Thanks for letting me know!


#13

You are welcome Jules. Thank you for solve it so quickly.