| 2757 | } |
| 2758 | |
| 2759 | void Document::removeObserver(DocumentObserver *pObserver) |
| 2760 | { |
| 2761 | // remove observer from the set. it won't receive notifications anymore |
| 2762 | if (d->m_observers.contains(pObserver)) { |
| 2763 | // free observer's pixmap data |
| 2764 | for (Page *const page : std::as_const(d->m_pagesVector)) { |
| 2765 | page->deletePixmap(pObserver); |
| 2766 | } |
| 2767 | |
| 2768 | // [MEM] free observer's allocation descriptors |
| 2769 | auto aIt = d->m_allocatedPixmaps.begin(); |
| 2770 | auto aEnd = d->m_allocatedPixmaps.end(); |
| 2771 | while (aIt != aEnd) { |
| 2772 | AllocatedPixmap *p = *aIt; |
| 2773 | if (p->observer == pObserver) { |
| 2774 | aIt = d->m_allocatedPixmaps.erase(aIt); |
| 2775 | delete p; |
| 2776 | } else { |
| 2777 | ++aIt; |
| 2778 | } |
| 2779 | } |
| 2780 | |
| 2781 | for (PixmapRequest *executingRequest : std::as_const(d->m_executingPixmapRequests)) { |
| 2782 | if (executingRequest->observer() == pObserver) { |
| 2783 | d->cancelRenderingBecauseOf(executingRequest, nullptr); |
| 2784 | } |
| 2785 | } |
| 2786 | |
| 2787 | // remove observer entry from the set |
| 2788 | d->m_observers.remove(pObserver); |
| 2789 | } |
| 2790 | } |
| 2791 | |
| 2792 | void Document::reparseConfig() |
| 2793 | { |