| 268 | } |
| 269 | |
| 270 | void BFApp::RemoveWindow(BFWindow* window) |
| 271 | { |
| 272 | AutoCrit autoCrit(mCritSect); |
| 273 | |
| 274 | auto itr = std::find(mWindowList.begin(), mWindowList.end(), window); |
| 275 | if (itr == mWindowList.end()) // Allow benign failure (double removal) |
| 276 | return; |
| 277 | mWindowList.erase(itr); |
| 278 | |
| 279 | while (window->mChildren.size() > 0) |
| 280 | RemoveWindow(window->mChildren.front()); |
| 281 | |
| 282 | if (window->mParent != NULL) |
| 283 | { |
| 284 | window->mParent->mChildren.erase(std::find(window->mParent->mChildren.begin(), window->mParent->mChildren.end(), window)); |
| 285 | |
| 286 | if (window->mFlags & BFWINDOW_MODAL) |
| 287 | { |
| 288 | bool hasModal = false; |
| 289 | |
| 290 | for (auto childWindow : window->mParent->mChildren) |
| 291 | { |
| 292 | if (childWindow->mFlags & BFWINDOW_MODAL) |
| 293 | hasModal = true; |
| 294 | } |
| 295 | |
| 296 | if (!hasModal) |
| 297 | window->mParent->ModalsRemoved(); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | window->mClosedFunc(window); |
| 302 | mRenderDevice->RemoveRenderWindow(window->mRenderWindow); |
| 303 | window->Destroy(); |
| 304 | mPendingWindowDeleteList.push_back(window); |
| 305 | } |
| 306 | |
| 307 | FileStream* BFApp::OpenBinaryFile(const StringImpl& fileName) |
| 308 | { |
no test coverage detected