comparison view/PaneStack.cpp @ 728:596414d20ef0 tonioni

Fix failure to delete property stack when pane is deleted (sometimes). Fixes Tony crash bug #881, needs to go in SV as well.
author Chris Cannam
date Tue, 04 Mar 2014 15:28:32 +0000
parents 67b167bb60ab
children b6dc57688c72
comparison
equal deleted inserted replaced
727:4eb741d63161 728:596414d20ef0
245 } 245 }
246 246
247 void 247 void
248 PaneStack::deletePane(Pane *pane) 248 PaneStack::deletePane(Pane *pane)
249 { 249 {
250 cerr << "PaneStack::deletePane(" << pane << ")" << endl;
251
250 std::vector<PaneRec>::iterator i; 252 std::vector<PaneRec>::iterator i;
251 bool found = false; 253 bool found = false;
252 254
255 QWidget *stack = 0;
256
253 for (i = m_panes.begin(); i != m_panes.end(); ++i) { 257 for (i = m_panes.begin(); i != m_panes.end(); ++i) {
254 if (i->pane == pane) { 258 if (i->pane == pane) {
259 stack = i->propertyStack;
255 m_panes.erase(i); 260 m_panes.erase(i);
256 found = true; 261 found = true;
257 break; 262 break;
258 } 263 }
259 } 264 }
260 265
261 if (!found) { 266 if (!found) {
262 267
263 for (i = m_hiddenPanes.begin(); i != m_hiddenPanes.end(); ++i) { 268 for (i = m_hiddenPanes.begin(); i != m_hiddenPanes.end(); ++i) {
264 if (i->pane == pane) { 269 if (i->pane == pane) {
270 stack = i->propertyStack;
265 m_hiddenPanes.erase(i); 271 m_hiddenPanes.erase(i);
266 found = true; 272 found = true;
267 break; 273 break;
268 } 274 }
269 } 275 }
273 return; 279 return;
274 } 280 }
275 } 281 }
276 282
277 emit paneAboutToBeDeleted(pane); 283 emit paneAboutToBeDeleted(pane);
284
285 cerr << "PaneStack::deletePane: about to delete parent " << pane->parent() << " of pane " << pane << endl;
286
287 // The property stack associated with the parent was initially
288 // created with the same parent as it, so it would be deleted when
289 // we delete the pane's parent in a moment -- but it may have been
290 // reparented depending on the layout. We'd better delete it
291 // separately first. (This fixes a crash on opening a new layer
292 // with a new unit type in it, when a long-defunct property box
293 // could be signalled from the unit database to tell it that a new
294 // unit had appeared.)
295 delete stack;
278 296
279 delete pane->parent(); 297 delete pane->parent();
280 298
281 if (m_currentPane == pane) { 299 if (m_currentPane == pane) {
282 if (m_panes.size() > 0) { 300 if (m_panes.size() > 0) {