Skip to content

Commit 1eecc68

Browse files
committed
Fixed an access violation in Flush() and FlushAndSubmit() of SkSurface when using the raster backend.
1 parent 8127810 commit 1eecc68

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

sk4d/src/c/sk4d_surface.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ void sk4d_surface_draw(sk_surface_t* self, sk_canvas_t* canvas, float x, float y
1818
// DEPRECATED
1919
void sk4d_surface_flush(sk_surface_t* self) {
2020
SK4D_ONLY_GPU(
21-
auto direct = AsSurface(self)->recordingContext()->asDirectContext();
22-
if (direct)
23-
direct->flush(AsSurface(self));)
21+
if (AsSurface(self)->recordingContext()) {
22+
auto direct = AsSurface(self)->recordingContext()->asDirectContext();
23+
direct->flush(AsSurface(self));
24+
})
2425
}
2526

2627
// DEPRECATED
2728
void sk4d_surface_flush_and_submit(sk_surface_t* self, gr_backendsemaphore_t* semaphores[], int32_t count, const gr_backendsurfacemutablestate_t* new_state, bool sync_cpu) {
2829
SK4D_ONLY_GPU(
29-
auto direct = AsSurface(self)->recordingContext()->asDirectContext();
30-
if (direct) {
30+
if (AsSurface(self)->recordingContext()) {
3131
GrFlushInfo info;
3232
std::vector<GrBackendSemaphore> vector;
3333
vector.reserve(count);
@@ -36,8 +36,9 @@ void sk4d_surface_flush_and_submit(sk_surface_t* self, gr_backendsemaphore_t* se
3636
info.fNumSemaphores = count;
3737
info.fSignalSemaphores = vector.data();
3838

39-
direct->flush(AsSurface(self), info, AsGrBackendSurfaceMutableState(new_state));
40-
direct->submit(AsGrSyncCpu(sync_cpu));
39+
auto direct = AsSurface(self)->recordingContext()->asDirectContext();
40+
direct->flush(AsSurface(self), info, AsGrBackendSurfaceMutableState(new_state));
41+
direct->submit(AsGrSyncCpu(sync_cpu));
4142
})
4243
}
4344

0 commit comments

Comments
 (0)