View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016171 | Scribus | Story Editor / Text Frames | public | 2020-07-19 08:23 | 2020-08-11 20:56 |
Reporter | ale | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Fixed in Version | 1.5.6.svn | ||||
Summary | 0016171: ScribusMainWindow::insertMark() should not delete the selection before executing the dialog | ||||
Description | there is a crash when: - selecting some text - insert > marks > anchor - cancel - click somewhere outside of the frame - crash i guess that the first step to resolve this bug is not to delete the selection before the dialog is executed. | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
|
this code crashes in the conditions described above: if (!HaveDoc) return; if (doc->m_Selection->count() != 1) return; if (doc->masterPageMode()) return; if (doc->appMode != modeEdit) return; PageItem* currItem = doc->m_Selection->itemAt(0); if (!currItem->isTextFrame()) return; InsertBookmarkDialog dialog(this); if (!dialog.exec()) return; UndoTransaction trans; if (currItem->HasSel) { if (UndoManager::instance()->undoEnabled()) trans = m_undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); //inserting mark replace some selected text currItem->asTextFrame()->deleteSelectedTextFromFrame(); } if (trans) trans.commit(); p.s.: the dialog does absolutely nothing. |
|
the problem seems to be that PageItem_TextFrame::deleteSelectedTextFromFrame() has its own transaction... |
|
trying to disable the undo manager during deleteSelectedTextFromFrame() did not resolve the crash: UndoTransaction trans; bool undoEnabled = m_undoManager->undoEnabled(); if (currItem->HasSel) { if (undoEnabled) { trans = m_undoManager->beginTransaction(Um::Selection,Um::IDelete,Um::Delete,"",Um::IDelete); m_undoManager->setUndoEnabled(false); } // TODO: instead of deleting the selection we should use it as the base for custom text //inserting mark replace some selected text currItem->asTextFrame()->deleteSelectedTextFromFrame(); if (undoEnabled) m_undoManager->setUndoEnabled(true); } if (trans) trans.commit(); |
|
>> the problem seems to be that >> PageItem_TextFrame::deleteSelectedTextFromFrame() >> has its own transaction... No, transactions are like groups for undo, they are made so that a transaction can embedded another one. |
|
The crash when cancelling was simply caused by the fact there was no text layout update after cancelling the dialog. Now that text selection is removed at its proper place, all is well. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-07-19 08:23 | ale | New Issue | |
2020-07-19 12:46 | ale | Note Added: 0047849 | |
2020-07-19 13:06 | ale | Note Added: 0047850 | |
2020-07-19 13:16 | ale | Note Added: 0047851 | |
2020-07-20 04:08 | jghali | Note Added: 0047852 | |
2020-07-20 04:14 | jghali | Note Edited: 0047852 | |
2020-07-20 04:38 | jghali | Assigned To | => jghali |
2020-07-20 04:38 | jghali | Status | new => resolved |
2020-07-20 04:38 | jghali | Resolution | open => fixed |
2020-07-20 04:38 | jghali | Fixed in Version | => 1.5.6.svn |
2020-07-20 04:38 | jghali | Note Added: 0047853 | |
2020-08-11 20:56 | cbradney | Status | resolved => closed |