Hi Jules,
I am using TreeView and custom component for TreeView item.
I get an assert when the TreeView is painted. Following is call history when click the open/close box if item.
Could you suggest me to avoid this assertion?
void TreeViewContentComponent::paint (Graphics& g)
{
if (owner->rootItem != 0)
{
owner->handleAsyncUpdate(); <--- jump
[code]void TreeView::handleAsyncUpdate()
{
if (needsRecalculating)
{
needsRecalculating = false;
const ScopedLock sl (nodeAlterationLock);
if (rootItem != 0)
rootItem->updatePositions (0);
((TreeViewport*) viewport)->updateComponents();
if (rootItem != 0)
{
viewport->getViewedComponent()
->setSize (jmax (viewport->getMaximumVisibleWidth(), rootItem->totalWidth),
rootItem->totalHeight - (rootItemVisible ? 0 : rootItem->itemHeight)); <--- jump[/code]
void Component::setSize (const int w, const int h)
{
setBounds (getX(), getY(), w, h); <--- jump
[code]void Component::setBounds (int x, int y, int w, int h)
{
// if component methods are being called from threads other than the message
// thread, you’ll need to use a MessageManagerLock object to make sure it’s thread-safe.
checkMessageManagerIsLocked
if (w < 0) w = 0;
if (h < 0) h = 0;
const bool wasResized = (getWidth() != w || getHeight() != h);
const bool wasMoved = (getX() != x || getY() != y);
#ifdef JUCE_DEBUG
// It’s a very bad idea to try to resize a component during its paint() method!
jassert (! (flags.isInsidePaintCall && wasResized)); <— Hit the assertion![/code]