| 299 | } |
| 300 | |
| 301 | bool ToolViewWidgetCache::disuse(const View& view) |
| 302 | { |
| 303 | Q_ASSERT(view.widget()); |
| 304 | const auto* const document = view.document(); |
| 305 | Q_ASSERT(document); |
| 306 | |
| 307 | const auto it = m_widgets.find(document); |
| 308 | Q_ASSERT(it != m_widgets.end()); |
| 309 | Q_ASSERT(it->widget() == view.widget()); |
| 310 | |
| 311 | if (it->useCount() == 1) { |
| 312 | m_widgets.erase(it); |
| 313 | qCDebug(SUBLIME) << "destroying a no longer used tool view widget" << document->documentSpecifier(); |
| 314 | return true; |
| 315 | } |
| 316 | |
| 317 | it->removeUse(); |
| 318 | qCDebug(SUBLIME).nospace() << "keeping a still used tool view widget " << document->documentSpecifier() |
| 319 | << ", use count: " << it->useCount(); |
| 320 | return false; |
| 321 | } |
| 322 | |
| 323 | QWidget* ToolViewWidgetCache::remove(const Document* document) |
| 324 | { |
no test coverage detected