JuliaPy / JuliaPy/PythonPlot.jl

Segfault when plotting to axis of closed figure

Đang mở
#28 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Julia
Star
85
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

If we attempt to plot to the axis of a figure that has already been displayed and closed, then on my machine Juliaa segfaults.

```julia
julia> fig, ax = subplots() # opens plot window, leave open
Python: (, )

julia> ax.scatter(randn(10), randn(10)) # adds plot to window
Python:
```

Then close the opened plot window and run the following, which causes the segfault.
```julia
julia> ax.scatter(randn(10), randn(10))
Python:

julia>
[306116] signal (11.1): Segmentation fault
in expression starting at none:0
Tk_GetImageMasterData at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtk8.6.so (unknown line)
Tk_FindPhoto at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtk8.6.so (unknown line)
_ZL11mpl_tk_blitP7_objectS0_ at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/site-packages/matplotlib/backends/_tkagg.cpython-311-x86_64-linux-gnu.so (unknown line)
cfunction_call at /usr/local/src/conda/python-3.11.4/Objects/methodobject.c:553
_PyObject_MakeTpCall at /usr/local/src/conda/python-3.11.4/Objects/call.c:214
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:4774
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
PythonCmd at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2252
TclNRRunCallbacks at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
Tkapp_Call at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:1462
method_vectorcall_VARARGS at /usr/local/src/conda/python-3.11.4/Objects/descrobject.c:330
_PyObject_VectorcallTstate at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_call.h:92 [inlined]
PyObject_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:299
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:4774
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
do_call_core at /usr/local/src/conda/python-3.11.4/Python/ceval.c:7357 [inlined]
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:5381
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393
do_call_core at /usr/local/src/conda/python-3.11.4/Python/ceval.c:7357 [inlined]
_PyEval_EvalFrameDefault at /usr/local/src/conda/python-3.11.4/Python/ceval.c:5381
_PyEval_EvalFrame at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_ceval.h:73 [inlined]
_PyEval_Vector at /usr/local/src/conda/python-3.11.4/Python/ceval.c:6439 [inlined]
_PyFunction_Vectorcall at /usr/local/src/conda/python-3.11.4/Objects/call.c:393 [inlined]
_PyObject_VectorcallTstate at /usr/local/src/conda/python-3.11.4/Include/internal/pycore_call.h:92
method_vectorcall at /usr/local/src/conda/python-3.11.4/Objects/classobject.c:67
PythonCmd at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2252
TclNRRunCallbacks at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
AfterProc at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
TclServiceIdle at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
Tcl_DoOneEvent at /tmp/jl_GaEsxY/.CondaPkg/env/lib/python3.11/lib-dynload/../../libtcl8.6.so (unknown line)
_tkinter_tkapp_dooneevent_impl at /usr/local/src/conda/python-3.11.4/Modules/_tkinter.c:2785 [inlined]
_tkinter_tkapp_dooneevent at /usr/local/src/conda/python-3.11.4/Modules/clinic/_tkinter.c.h:566
cfunction_vectorcall_FASTCALL at /usr/local/src/conda/python-3.11.4/Objects/methodobject.c:427
PyObject_CallObject at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/cpython/pointers.jl:299 [inlined]
macro expansion at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:131 [inlined]
pycallargs at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:210
unknown function (ip: 0x7f4b801c1ea6)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
#pycall#59 at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:228
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
pycall at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:218
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
#_#11 at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:341
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
do_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/builtins.c:730
Py at /home/sethaxen/.julia/packages/PythonCall/qTEA1/src/Py.jl:341
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
#9 at /home/sethaxen/.julia/packages/PythonPlot/f591M/src/pygui.jl:199
macro expansion at ./asyncevent.jl:281 [inlined]
#702 at ./task.jl:134
unknown function (ip: 0x7f4b801d59df)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2758 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/gf.c:2940
jl_apply at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/julia.h:1879 [inlined]
start_task at /cache/build/default-amdci5-2/julialang/julia-release-1-dot-9/src/task.c:1092
Allocations: 10747647 (Pool: 10739903; Big: 7744); GC: 15
Segmentation fault (core dumped)
```

If plotting to this axis is not supported, it would be much better to throw an error.

## Environment

```julia
julia> versioninfo()
Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
Threads: 8 on 8 virtual cores
Environment:
JULIA_CMDSTAN_HOME = /home/sethaxen/software/cmdstan/2.30.1/
JULIA_NUM_THREADS = auto
JULIA_EDITOR = code

(jl_jbDJBf) pkg> st
Status `/tmp/jl_jbDJBf/Project.toml`
[274fc56d] PythonPlot v1.0.2
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.