# Plots.jl: QPaintDevice: Cannot destroy paint device that is being painted \[SOLVED\]

**URL:** <https://discourse.julialang.org/t/plots-jl-qpaintdevice-cannot-destroy-paint-device-that-is-being-painted-solved/135323>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [January 29, 2026, 1:18pm UTC](https://discourse.julialang.org/t/plots-jl-qpaintdevice-cannot-destroy-paint-device-that-is-being-painted-solved/135323 "2026-01-29T13:18:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericsfraga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericsfraga/32/192_2.png) [@ericsfraga](https://discourse.julialang.org/u/ericsfraga)\
**Post date:** [January 29, 2026, 1:18pm UTC](https://discourse.julialang.org/t/plots-jl-qpaintdevice-cannot-destroy-paint-device-that-is-being-painted-solved/135323/1 "2026-01-29T13:18:25Z")

</div>

Good morning. Anybody here using the Plots.jl package for Julia? I am trying to generate some plots in files without having them display on the screen. I have a sequence of

```julia-auto
plt = plot(...)
plot!(plt, ...)
plot!(plt, ...)
savefig(plt, filename)

```

in a script (not interactive) which invariably leads to errors while running:

```julia-auto
QPaintDevice: Cannot destroy paint device that is being painted
Segmentation fault (core dumped)

```

The actual plots in the files are generated just fine and my program runs fine otherwise but the errors are annoying and the display flickers. I have tried setting the `show = false` option to all plot calls to no effect.

(I’ve asked this on mastodon where I got some nice answers but nothing so far that has worked unfortunately. I don’t particularly like discourse as it requires me using an overblown web browser… I’m old skool. 😉 )

---

<div class="post-metadata">

**Author:** ![ericsfraga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericsfraga/32/192_2.png) [@ericsfraga](https://discourse.julialang.org/u/ericsfraga)\
**Post date:** [January 29, 2026, 1:46pm UTC](https://discourse.julialang.org/t/plots-jl-qpaintdevice-cannot-destroy-paint-device-that-is-being-painted-solved/135323/2 "2026-01-29T13:46:15Z")

</div>

**Solved**!

On mastodon, the solution proposed was to add the line

```julia-auto
ENV["GKSwstype"]="nul"

```

at the start and it does the job!

I’ll leave this thread here for others that might run into this problem.
