Commit ff115ccb authored by Agata Cacko's avatar Agata Cacko
Browse files

Fix crash on undo after importing assistant set

Before this commit, importing assistant set was not undoable,
which broke internal state of the tool, which led to crash.
This commit makes importing the assistant set undoable,
preventing the crash.

BUG:455584


(cherry picked from commit 6579f94c)
parent 2ce015e3
Pipeline #196169 passed with stage
in 90 minutes and 11 seconds
......@@ -1169,6 +1169,10 @@ void KisAssistantTool::loadAssistants()
QMap<int, KisPaintingAssistantHandleSP> sideHandleMap;
KisPaintingAssistantSP assistant;
bool errors = false;
m_origAssistantList = KisPaintingAssistant::cloneAssistantList(m_canvas->paintingAssistantsDecoration()->assistants());
while (!xml.atEnd()) {
switch (xml.readNext()) {
case QXmlStreamReader::StartElement:
......@@ -1303,9 +1307,12 @@ void KisAssistantTool::loadAssistants()
if (errors) {
QMessageBox::warning(qApp->activeWindow(), i18nc("@title:window", "Krita"), i18n("Errors were encountered. Not all assistants were successfully loaded."));
}
KUndo2Command *command = new EditAssistantsCommand(m_canvas, m_origAssistantList, KisPaintingAssistant::cloneAssistantList(m_canvas->paintingAssistantsDecoration()->assistants()));
m_canvas->viewManager()->undoAdapter()->addCommand(command);
m_handles = m_canvas->paintingAssistantsDecoration()->handles();
m_canvas->updateCanvas();
}
void KisAssistantTool::saveAssistants()
......
Supports Markdown
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