| 254 | } |
| 255 | |
| 256 | void Document::clearPages() |
| 257 | { |
| 258 | // Clear the processing thread to ensure no task still needs the pages we are |
| 259 | // about to destroy. |
| 260 | // NB: Do this before acquiring _docLock. See clearWorkStack() documentation. |
| 261 | // This should not cause any problems as we are supposed to currently be in |
| 262 | // the main (GUI) thread, and only this thread is supposed to add items to the |
| 263 | // work stack. |
| 264 | _processingThread.clearWorkStack(); |
| 265 | |
| 266 | QWriteLocker docLocker(_docLock.data()); |
| 267 | foreach(QSharedPointer<Page> page, _pages) { |
| 268 | if (page.isNull()) |
| 269 | continue; |
| 270 | page->detachFromParent(); |
| 271 | } |
| 272 | // Note: clear() releases all QSharedPointer to pages, thereby destroying them |
| 273 | // (if they are not used elsewhere) |
| 274 | _pages.clear(); |
| 275 | } |
| 276 | |
| 277 | void Document::clearMetaData() |
| 278 | { |
no test coverage detected