From 306e7efd395ae6ebde7ee5832271ccceb4bead88 Mon Sep 17 00:00:00 2001
From: Thierry Bastian <thierry.bastian@nokia.com>
Date: Wed, 9 Sep 2009 13:31:04 +0200
Subject: Fix a possible crash when deleting the QMainWindow layout

It can happen that an item is still a gap and could then be deleted
twice. We now check that to avoid double deletion.
Note: it doesn't fix the bug but avoids the crash.

Task-number: 260873
---
 src/gui/widgets/qtoolbararealayout.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index cd5c131..de11625 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -776,7 +776,8 @@ void QToolBarAreaLayout::deleteAllLayoutItems()
 
             for (int k = 0; k < line.toolBarItems.count(); ++k) {
                 QToolBarAreaLayoutItem &item = line.toolBarItems[k];
-                delete item.widgetItem;
+                if (!item.gap)
+                    delete item.widgetItem;
                 item.widgetItem = 0;
             }
         }
-- 
cgit v0.12