void Selection::_emitChanged(bool persist_selection_context/* = false */) { if (persist_selection_context) { if (NULL == _selection_context) { _selection_context = _layers->currentLayer(); sp_object_ref(_selection_context, NULL); _context_release_connection = _selection_context->connectRelease(sigc::mem_fun(*this, &Selection::_releaseContext)); } } else { _releaseContext(_selection_context); } INKSCAPE.selection_changed(this); _changed_signal.emit(this); }
/* * return true if the context was destroyed, false if only its refcount * got decreased. Note that even if the context was destroyed it may * still live, if it's the currently selected context (by setContext). */ bool releaseContext(uintptr_t context_id) { bool res = false; context_map_mutex.lock(); /* * This can potentially called (from glX) with an invalid context_id, * so don't assert on it being valid. */ if (context_map.find(context_id) != context_map.end()) { res = _releaseContext(context_map[context_id]); if (res) context_map.erase(context_id); } context_map_mutex.unlock(); return res; }