* fix a crash when closing Cortex with some connected nodes
This should have crashed on R5 too, what happend is that deleting a 'Box' will cause a release of it's EndPoints, thus leaving some dangling EndPoint pointers in the Wires, which they access to call disconnect. So deletion order is important here, delete Wires first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27880 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,37 +37,40 @@ DiagramItemGroup::DiagramItemGroup(uint32 acceptedTypes, bool multiSelection)
|
|||||||
DiagramItemGroup::~DiagramItemGroup()
|
DiagramItemGroup::~DiagramItemGroup()
|
||||||
{
|
{
|
||||||
D_METHOD(("DiagramItemGroup::~DiagramItemGroup()\n"));
|
D_METHOD(("DiagramItemGroup::~DiagramItemGroup()\n"));
|
||||||
if (fSelection) {
|
|
||||||
fSelection->MakeEmpty();
|
|
||||||
delete fSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fBoxes && (fTypes & DiagramItem::M_BOX)) {
|
|
||||||
while (CountItems(DiagramItem::M_BOX) > 0) {
|
|
||||||
DiagramItem *item = ItemAt(0, DiagramItem::M_BOX);
|
|
||||||
if (RemoveItem(item))
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
delete fBoxes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int32 count = 0;
|
||||||
if (fWires && (fTypes & DiagramItem::M_WIRE)) {
|
if (fWires && (fTypes & DiagramItem::M_WIRE)) {
|
||||||
while (CountItems(DiagramItem::M_WIRE) > 0) {
|
count = fWires->CountItems();
|
||||||
DiagramItem *item = ItemAt(0, DiagramItem::M_WIRE);
|
for (int32 i = 0; i < count; ++i) {
|
||||||
|
DiagramItem* item = static_cast<DiagramItem*>(fWires->ItemAtFast(i));
|
||||||
if (RemoveItem(item))
|
if (RemoveItem(item))
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
delete fWires;
|
delete fWires;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fBoxes && (fTypes & DiagramItem::M_BOX)) {
|
||||||
|
count = fBoxes->CountItems();
|
||||||
|
for (int32 i = 0; i < count; ++i) {
|
||||||
|
DiagramItem* item = static_cast<DiagramItem*>(fBoxes->ItemAtFast(i));
|
||||||
|
if (RemoveItem(item))
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
delete fBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
if (fEndPoints && (fTypes & DiagramItem::M_ENDPOINT)) {
|
if (fEndPoints && (fTypes & DiagramItem::M_ENDPOINT)) {
|
||||||
while (CountItems(DiagramItem::M_ENDPOINT) > 0) {
|
count = fEndPoints->CountItems();
|
||||||
DiagramItem *item = ItemAt(0, DiagramItem::M_ENDPOINT);
|
for (int32 i = 0; i < count; ++i) {
|
||||||
|
DiagramItem* item = static_cast<DiagramItem*>(fEndPoints->ItemAtFast(i));
|
||||||
if (RemoveItem(item))
|
if (RemoveItem(item))
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
delete fEndPoints;
|
delete fEndPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fSelection)
|
||||||
|
delete fSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +89,6 @@ DiagramItemGroup::CountItems(uint32 whichType) const
|
|||||||
if (whichType & DiagramItem::M_BOX) {
|
if (whichType & DiagramItem::M_BOX) {
|
||||||
if (fBoxes)
|
if (fBoxes)
|
||||||
count += fBoxes->CountItems();
|
count += fBoxes->CountItems();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichType & DiagramItem::M_WIRE) {
|
if (whichType & DiagramItem::M_WIRE) {
|
||||||
@@ -198,6 +200,9 @@ DiagramItemGroup::AddItem(DiagramItem *item)
|
|||||||
{
|
{
|
||||||
D_METHOD(("DiagramItemGroup::AddItem()\n"));
|
D_METHOD(("DiagramItemGroup::AddItem()\n"));
|
||||||
if (item && (fTypes & item->type())) {
|
if (item && (fTypes & item->type())) {
|
||||||
|
if (item->m_group)
|
||||||
|
item->m_group->RemoveItem(item);
|
||||||
|
|
||||||
switch (item->type()) {
|
switch (item->type()) {
|
||||||
case DiagramItem::M_BOX:
|
case DiagramItem::M_BOX:
|
||||||
if (!fBoxes)
|
if (!fBoxes)
|
||||||
|
|||||||
@@ -376,7 +376,9 @@ void MediaJack::_updateBitmap()
|
|||||||
tempBitmap->AddChild(tempView);
|
tempBitmap->AddChild(tempView);
|
||||||
tempView->SetOrigin(0.0, 0.0);
|
tempView->SetOrigin(0.0, 0.0);
|
||||||
|
|
||||||
int32 layout = dynamic_cast<MediaRoutingView *>(view())->getLayout();
|
MediaRoutingView* mediaView = dynamic_cast<MediaRoutingView*>(view());
|
||||||
|
int32 layout = mediaView ? mediaView->getLayout() : MediaRoutingView::M_ICON_VIEW;
|
||||||
|
|
||||||
_drawInto(tempView, tempView->Bounds(), layout);
|
_drawInto(tempView, tempView->Bounds(), layout);
|
||||||
|
|
||||||
tempView->Sync();
|
tempView->Sync();
|
||||||
|
|||||||
Reference in New Issue
Block a user