Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
1a980008
Commit
1a980008
authored
May 18, 2022
by
Albert Astals Cid
Browse files
Fix crash while undoing with the menu on an empty annotation
BUGS: 453987
parent
dbe951e1
Pipeline
#179763
passed with stage
in 6 minutes and 44 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
part/annotwindow.cpp
View file @
1a980008
...
@@ -326,7 +326,16 @@ void AnnotWindow::slotUpdateUndoAndRedoInContextMenu(QMenu *menu)
...
@@ -326,7 +326,16 @@ void AnnotWindow::slotUpdateUndoAndRedoInContextMenu(QMenu *menu)
QList
<
QAction
*>
actionList
=
menu
->
actions
();
QList
<
QAction
*>
actionList
=
menu
->
actions
();
enum
{
UndoAct
,
RedoAct
,
CutAct
,
CopyAct
,
PasteAct
,
ClearAct
,
SelectAllAct
,
NCountActs
};
enum
{
UndoAct
,
RedoAct
,
CutAct
,
CopyAct
,
PasteAct
,
ClearAct
,
SelectAllAct
,
NCountActs
};
QAction
*
kundo
=
KStandardAction
::
create
(
KStandardAction
::
Undo
,
m_document
,
SLOT
(
undo
()),
menu
);
QAction
*
kundo
=
KStandardAction
::
create
(
KStandardAction
::
Undo
,
m_document
,
[
doc
=
m_document
]
{
// We need a QueuedConnection because undoing may end up destroying the menu this action is on
// because it will undo the addition of the annotation. If it's not queued things gets unhappy
// because the menu is destroyed in the middle of processing the click on the menu itself
QMetaObject
::
invokeMethod
(
doc
,
&
Okular
::
Document
::
undo
,
Qt
::
QueuedConnection
);
},
menu
);
QAction
*
kredo
=
KStandardAction
::
create
(
KStandardAction
::
Redo
,
m_document
,
SLOT
(
redo
()),
menu
);
QAction
*
kredo
=
KStandardAction
::
create
(
KStandardAction
::
Redo
,
m_document
,
SLOT
(
redo
()),
menu
);
connect
(
m_document
,
&
Okular
::
Document
::
canUndoChanged
,
kundo
,
&
QAction
::
setEnabled
);
connect
(
m_document
,
&
Okular
::
Document
::
canUndoChanged
,
kundo
,
&
QAction
::
setEnabled
);
connect
(
m_document
,
&
Okular
::
Document
::
canRedoChanged
,
kredo
,
&
QAction
::
setEnabled
);
connect
(
m_document
,
&
Okular
::
Document
::
canRedoChanged
,
kredo
,
&
QAction
::
setEnabled
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment