Commit aa81a25f authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix an assert when creating a vector selection

The problem is that selectionChanged() signal may easily arrive
later than some GUI code requests the shape manager, therefore the
assert will register an inconsistent state (which is actually, yes,
inconsistent)

CCBUG:391292
parent dddd8c48
......@@ -140,6 +140,8 @@ public:
bool effectiveLodAllowedInCanvas() {
return lodAllowedInCanvas && !bootstrapLodBlocked;
}
void setActiveShapeManager(KoShapeManager *shapeManager);
};
namespace {
......@@ -362,11 +364,23 @@ void KisCanvas2::addCommand(KUndo2Command *command)
m_d->view->document()->addCommand(command);
}
void KisCanvas2::KisCanvas2Private::setActiveShapeManager(KoShapeManager *shapeManager)
{
if (shapeManager != currentlyActiveShapeManager) {
currentlyActiveShapeManager = shapeManager;
selectedShapesProxy.setShapeManager(shapeManager);
}
}
KoShapeManager* KisCanvas2::shapeManager() const
{
KisNodeSP node = m_d->view->currentNode();
KoShapeManager *localShapeManager = fetchShapeManagerFromNode(node);
if (localShapeManager != m_d->currentlyActiveShapeManager) {
m_d->setActiveShapeManager(localShapeManager);
}
// sanity check for consistency of the local shape manager
KIS_SAFE_ASSERT_RECOVER (localShapeManager == m_d->currentlyActiveShapeManager) {
localShapeManager = globalShapeManager();
......@@ -794,17 +808,12 @@ void KisCanvas2::notifyZoomChanged()
void KisCanvas2::slotTrySwitchShapeManager()
{
QPointer<KoShapeManager> oldManager = m_d->currentlyActiveShapeManager;
KisNodeSP node = m_d->view->currentNode();
QPointer<KoShapeManager> newManager;
newManager = fetchShapeManagerFromNode(node);
if (newManager != oldManager) {
m_d->currentlyActiveShapeManager = newManager;
m_d->selectedShapesProxy.setShapeManager(newManager);
}
m_d->setActiveShapeManager(newManager);
}
void KisCanvas2::notifyLevelOfDetailChange()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment