[SOLVED] when FileTreeComponent's width less than a value, it'll hit the jassert


#1

Or: if a folder has a lot of sub-folders, when unfold it to a sub-folder in lower level one by one, it’ll hit the jassert also…That means: when a fileTreeComponent has no space enough to display the folder’s name (text), this situation will be appeared suddenly.

In Debug mode, both on Windows, macOS, haven’t tested on Linux yet, but I think it will be the same.

The jassert in: “…/modules/juce_graphics/contexts/juce_GraphicsContext.cpp”, line 33~36 (by that time, w < 0):

namespace
{
    template 
    Rectangle coordsToRectangle (Type x, Type y, Type w, Type h) noexcept
    {
       #if JUCE_DEBUG
        const int maxVal = 0x3fffffff;

        jassert ((int) x >= -maxVal && (int) x <= maxVal
              && (int) y >= -maxVal && (int) y <= maxVal
              && (int) w >= 0 && (int) w <= maxVal
              && (int) h >= 0 && (int) h <= maxVal);
       #endif 

        return Rectangle (x, y, w, h);
    }
}

Stack trace (test in JuceDemo, Windows 10 64bit/macOS 10.11.6, JUCE-develop, latest-tip. These are from Windows):

>	JuceDemo.exe!juce::`anonymous namespace'::coordsToRectangle(int x, int y, int w, int h) 行 33	C++
 	JuceDemo.exe!juce::Graphics::drawFittedText(const juce::String & text, int x, int y, int width, int height, juce::Justification justification, int maximumNumberOfLines, float minimumHorizontalScale) 行 336	C++
 	JuceDemo.exe!juce::LookAndFeel_V2::drawFileBrowserRow(juce::Graphics & g, int width, int height, const juce::String & filename, juce::Image * icon, const juce::String & fileSizeDescription, const juce::String & fileTimeDescription, bool isDirectory, bool isItemSelected, int __formal, juce::DirectoryContentsDisplayComponent & dcc) 行 2541	C++
 	JuceDemo.exe!juce::FileListTreeItem::paintItem(juce::Graphics & g, int width, int height) 行 183	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1563	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeViewItem::paintRecursively(juce::Graphics & g, int width) 行 1624	C++
 	JuceDemo.exe!juce::TreeView::ContentComponent::paint(juce::Graphics & g) 行 151	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 1980	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g) 行 1963	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g) 行 2026	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g, bool ignoreAlphaLevel) 行 2085	C++
...

[BUG] when a propertyPanel’s width less than a value, it’ll hit the jassert
#2

I’ll have a look at this. I can easily reproduce this. What’s strange is that if you ignore the assertion and open yet another sub-folder then the horizontal scroll bar appears and everything is fine again. It seems that the logic when the scroll bar appears is slightly wrong.

I’ve created a bug so that you can track our progress.


#3

This should be fixed on develop now.

Ed


#4

Renewed normal, it works now. Thanks @fabian and @ed95.