From ebea950b2df08711adaca9f2c0d282d48667e545 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 18 Apr 2015 13:18:29 +0200 Subject: [PATCH] BLayout: Don't delete the layout of the view in RemoveView(). The layout item representing the layout of the view to be removed is owned by the view and must not be deleted. The layout only owns the item if a new layout item was created when adding the view, i.e. when it did not have a layout. Fixes the underlying issue that triggered #11976. --- src/kits/interface/Layout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/Layout.cpp b/src/kits/interface/Layout.cpp index a066f36115..4feaa4c9b6 100644 --- a/src/kits/interface/Layout.cpp +++ b/src/kits/interface/Layout.cpp @@ -209,7 +209,8 @@ BLayout::RemoveView(BView* child) continue; RemoveItem(i); - delete item; + if (item != child->GetLayout()) + delete item; remaining--; removed = true;