Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Scott Petrovic
Krita
Commits
3f7e32c9
Commit
3f7e32c9
authored
Aug 02, 2019
by
Dmitry Kazakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix race condition in start/stop isolated mode
We should not use QtCuncurrent anywhere in Krita
parent
dea45823
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
libs/image/kis_image.cc
libs/image/kis_image.cc
+23
-10
No files found.
libs/image/kis_image.cc
View file @
3f7e32c9
...
...
@@ -104,6 +104,11 @@
#include "kis_time_range.h"
#include "KisRunnableBasedStrokeStrategy.h"
#include "KisRunnableStrokeJobData.h"
#include "KisRunnableStrokeJobUtils.h"
#include "KisRunnableStrokeJobsInterface.h"
// #define SANITY_CHECKS
#ifdef SANITY_CHECKS
...
...
@@ -238,7 +243,7 @@ public:
bool
tryCancelCurrentStrokeAsync
();
void
notifyProjectionUpdatedInPatches
(
const
QRect
&
rc
);
void
notifyProjectionUpdatedInPatches
(
const
QRect
&
rc
,
QVector
<
KisRunnableStrokeJobData
*>
&
jobs
);
};
KisImage
::
KisImage
(
KisUndoStore
*
undoStore
,
qint32
width
,
qint32
height
,
const
KoColorSpace
*
colorSpace
,
const
QString
&
name
)
...
...
@@ -1520,7 +1525,7 @@ KisStrokeId KisImage::startStroke(KisStrokeStrategy *strokeStrategy)
return
m_d
->
scheduler
.
startStroke
(
strokeStrategy
);
}
void
KisImage
::
KisImagePrivate
::
notifyProjectionUpdatedInPatches
(
const
QRect
&
rc
)
void
KisImage
::
KisImagePrivate
::
notifyProjectionUpdatedInPatches
(
const
QRect
&
rc
,
QVector
<
KisRunnableStrokeJobData
*>
&
jobs
)
{
KisImageConfig
imageConfig
(
true
);
int
patchWidth
=
imageConfig
.
updatePatchWidth
();
...
...
@@ -1531,20 +1536,21 @@ void KisImage::KisImagePrivate::notifyProjectionUpdatedInPatches(const QRect &rc
QRect
patchRect
(
x
,
y
,
patchWidth
,
patchHeight
);
patchRect
&=
rc
;
QtConcurrent
::
run
(
std
::
bind
(
&
KisImage
::
notifyProjectionUpdated
,
q
,
patchRect
));
KritaUtils
::
addJobConcurrent
(
jobs
,
std
::
bind
(
&
KisImage
::
notifyProjectionUpdated
,
q
,
patchRect
));
}
}
}
bool
KisImage
::
startIsolatedMode
(
KisNodeSP
node
)
{
struct
StartIsolatedModeStroke
:
public
Kis
Simple
StrokeStrategy
{
struct
StartIsolatedModeStroke
:
public
Kis
RunnableBased
StrokeStrategy
{
StartIsolatedModeStroke
(
KisNodeSP
node
,
KisImageSP
image
)
:
Kis
Simple
StrokeStrategy
(
"start-isolated-mode"
,
kundo2_noi18n
(
"start-isolated-mode"
)),
:
Kis
RunnableBased
StrokeStrategy
(
"start-isolated-mode"
,
kundo2_noi18n
(
"start-isolated-mode"
)),
m_node
(
node
),
m_image
(
image
)
{
this
->
enableJob
(
JOB_INIT
,
true
,
KisStrokeJobData
::
SEQUENTIAL
,
KisStrokeJobData
::
EXCLUSIVE
);
this
->
enableJob
(
JOB_DOSTROKE
,
true
);
setClearsRedoOnStart
(
false
);
}
...
...
@@ -1558,7 +1564,10 @@ bool KisImage::startIsolatedMode(KisNodeSP node)
// the GUI uses our thread to do the color space conversion so we
// need to emit this signal in multiple threads
m_image
->
m_d
->
notifyProjectionUpdatedInPatches
(
m_image
->
bounds
());
QVector
<
KisRunnableStrokeJobData
*>
jobs
;
m_image
->
m_d
->
notifyProjectionUpdatedInPatches
(
m_image
->
bounds
(),
jobs
);
this
->
runnableJobsInterface
()
->
addRunnableJobs
(
jobs
);
m_image
->
invalidateAllFrames
();
}
...
...
@@ -1578,12 +1587,13 @@ void KisImage::stopIsolatedMode()
{
if
(
!
m_d
->
isolatedRootNode
)
return
;
struct
StopIsolatedModeStroke
:
public
Kis
Simple
StrokeStrategy
{
struct
StopIsolatedModeStroke
:
public
Kis
RunnableBased
StrokeStrategy
{
StopIsolatedModeStroke
(
KisImageSP
image
)
:
Kis
Simple
StrokeStrategy
(
"stop-isolated-mode"
,
kundo2_noi18n
(
"stop-isolated-mode"
)),
:
Kis
RunnableBased
StrokeStrategy
(
"stop-isolated-mode"
,
kundo2_noi18n
(
"stop-isolated-mode"
)),
m_image
(
image
)
{
this
->
enableJob
(
JOB_INIT
);
this
->
enableJob
(
JOB_DOSTROKE
,
true
);
setClearsRedoOnStart
(
false
);
}
...
...
@@ -1595,10 +1605,13 @@ void KisImage::stopIsolatedMode()
emit
m_image
->
sigIsolatedModeChanged
();
m_image
->
invalidateAllFrames
();
// the GUI uses our thread to do the color space conversion so we
// need to emit this signal in multiple threads
m_image
->
m_d
->
notifyProjectionUpdatedInPatches
(
m_image
->
bounds
());
m_image
->
invalidateAllFrames
();
QVector
<
KisRunnableStrokeJobData
*>
jobs
;
m_image
->
m_d
->
notifyProjectionUpdatedInPatches
(
m_image
->
bounds
(),
jobs
);
this
->
runnableJobsInterface
()
->
addRunnableJobs
(
jobs
);
// TODO: Substitute notifyProjectionUpdated() with this code
// when update optimization is implemented
...
...
Write
Preview
Markdown
is supported
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