Mercurial > hg > svgui
comparison view/PaneStack.cpp @ 729:25b3d5802e6e
Fix failure to delete property stack when pane is deleted (sometimes)
author | Chris Cannam |
---|---|
date | Tue, 04 Mar 2014 15:32:28 +0000 |
parents | 1a0dfcbffaf1 |
children | b6dc57688c72 |
comparison
equal
deleted
inserted
replaced
725:c27a3604fe6f | 729:25b3d5802e6e |
---|---|
234 } | 234 } |
235 | 235 |
236 void | 236 void |
237 PaneStack::deletePane(Pane *pane) | 237 PaneStack::deletePane(Pane *pane) |
238 { | 238 { |
239 cerr << "PaneStack::deletePane(" << pane << ")" << endl; | |
240 | |
239 std::vector<PaneRec>::iterator i; | 241 std::vector<PaneRec>::iterator i; |
240 bool found = false; | 242 bool found = false; |
241 | 243 |
244 QWidget *stack = 0; | |
245 | |
242 for (i = m_panes.begin(); i != m_panes.end(); ++i) { | 246 for (i = m_panes.begin(); i != m_panes.end(); ++i) { |
243 if (i->pane == pane) { | 247 if (i->pane == pane) { |
248 stack = i->propertyStack; | |
244 m_panes.erase(i); | 249 m_panes.erase(i); |
245 found = true; | 250 found = true; |
246 break; | 251 break; |
247 } | 252 } |
248 } | 253 } |
249 | 254 |
250 if (!found) { | 255 if (!found) { |
251 | 256 |
252 for (i = m_hiddenPanes.begin(); i != m_hiddenPanes.end(); ++i) { | 257 for (i = m_hiddenPanes.begin(); i != m_hiddenPanes.end(); ++i) { |
253 if (i->pane == pane) { | 258 if (i->pane == pane) { |
259 stack = i->propertyStack; | |
254 m_hiddenPanes.erase(i); | 260 m_hiddenPanes.erase(i); |
255 found = true; | 261 found = true; |
256 break; | 262 break; |
257 } | 263 } |
258 } | 264 } |
262 return; | 268 return; |
263 } | 269 } |
264 } | 270 } |
265 | 271 |
266 emit paneAboutToBeDeleted(pane); | 272 emit paneAboutToBeDeleted(pane); |
273 | |
274 cerr << "PaneStack::deletePane: about to delete parent " << pane->parent() << " of pane " << pane << endl; | |
275 | |
276 // The property stack associated with the parent was initially | |
277 // created with the same parent as it, so it would be deleted when | |
278 // we delete the pane's parent in a moment -- but it may have been | |
279 // reparented depending on the layout. We'd better delete it | |
280 // separately first. (This fixes a crash on opening a new layer | |
281 // with a new unit type in it, when a long-defunct property box | |
282 // could be signalled from the unit database to tell it that a new | |
283 // unit had appeared.) | |
284 delete stack; | |
267 | 285 |
268 delete pane->parent(); | 286 delete pane->parent(); |
269 | 287 |
270 if (m_currentPane == pane) { | 288 if (m_currentPane == pane) { |
271 if (m_panes.size() > 0) { | 289 if (m_panes.size() > 0) { |