Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
fddcd6ef
Commit
fddcd6ef
authored
Aug 03, 2022
by
Pablo Rauzy
Committed by
Christoph Cullmann
Aug 14, 2022
Browse files
fix race condition between multiple instances of Kate for saving named macros
parent
66ddc65c
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/keyboardmacros/keyboardmacrosplugin.cpp
View file @
fddcd6ef
...
...
@@ -232,6 +232,14 @@ void KeyboardMacrosPlugin::loadNamedMacros()
void
KeyboardMacrosPlugin
::
saveNamedMacros
()
{
// first keep a copy of the named macros of our instance
QMap
<
QString
,
Macro
>
ourNamedMacros
;
ourNamedMacros
.
swap
(
m_namedMacros
);
// then reload from storage in case another instance saved macros since we first loaded ours from storage
loadNamedMacros
();
// then insert all of our macros, prioritizing ours in case of name conflict since we are the most recent save
m_namedMacros
.
insert
(
ourNamedMacros
);
// and now save named macros
QFile
storage
(
m_storage
);
if
(
!
storage
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
sendMessage
(
i18n
(
"Could not open file '%1'."
,
m_storage
),
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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