# EXC\_BAD\_ACCESS in a ~ResizeableBorder

**URL:** <https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920>\
**Category:** General JUCE discussion\
**Created:** [November 23, 2010, 4:23am UTC](https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920 "2010-11-23T04:23:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruce-wheaton](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bruce-wheaton](https://forum.juce.com/u/bruce-wheaton)\
**Post date:** [November 23, 2010, 4:23am UTC](https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920/1 "2010-11-23T04:23:05Z")

</div>

In the latest juce, I’m getting crashes as shut down. When the destructor chain gets to deleting:

MyDocWindow \> DocumentWindow \> ResizeableWindow and it tries to set the resizableBorder member to 0, I get a crash in the ScopedPointer assignment method. It seems like the border component isn’t real? Can’t see why it would have already been deleted, or why it would be uninitialized, but there it is.

I would say a random memory corruption, but it seems consistent? Every time the ‘old’ resizeable component is deleted.

The only things I’m changing that seem related are:

[code] setResizable(true, false);  
setResizeLimits (768, 480, 2560, 1200);

```
setUsingNativeTitleBar(true);

```

[/code]

The only child is a component I added with setContentComponent, and have left for the window to erase.

Testing on Mac, latest xcode (3.2.5?).

Bruce

``

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 23, 2010, 9:29am UTC](https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920/2 "2010-11-23T09:29:38Z")

</div>

Can’t see any reason why that’d happen… You’re not doing anything silly like calling deleteAllChildren() on the window are you?

---

<div class="post-metadata">

**Author:** ![bruce-wheaton](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bruce-wheaton](https://forum.juce.com/u/bruce-wheaton)\
**Post date:** [November 23, 2010, 11:27pm UTC](https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920/3 "2010-11-23T23:27:36Z")

</div>

No but yeah but no but… oops.

I guess that was in there for a while. I guess the content component stuff overrides it?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 24, 2010, 9:49am UTC](https://forum.juce.com/t/exc-bad-access-in-a-resizeableborder/5920/4 "2010-11-24T09:49:07Z")

</div>

The content comp used to use deleteAllChildren() itself to delete its borders, rather than deleting them directly. But now that I’ve cleaned it up to use ScopedPointers, the extent of your evilness becomes apparent.

I’ll put in an assertion to catch any other miscreants who try the same thing…
