sciapp / python-gr

Python wrapper for the GR framework
https://gr-framework.org
Other
30 stars 8 forks source link

Calling inqlinetype before setting lintype causes a crash #11

Closed kojix2 closed 4 years ago

kojix2 commented 4 years ago

Hello. Thank you for the great project. This is a minor issue.

import gr
gr.setlinetype(3)
print(gr.inqlinetype())

3

import gr
gr.inqlinetype()
import gr
gr.inqlinewidth()

Segmentation fault (core dumped)

FlorianRhiem commented 4 years ago

GR and GKS need to be initialized before being used and many GR functions check whether this has been done yet and do it if necessary. Apparently, some functions expect the user to have used GR before, including some inquire functions. As a result these functions may crash if they are called straight away.

I've prepared a fix for this, adding new autoinit checks to several functions. Until then, a simple workaround would be to call another GR function first which does perform the initialization, e.g. gr.clearws() or gr.inqdspsize().

kojix2 commented 4 years ago

I see. Thank you.

FlorianRhiem commented 4 years ago

The issue has been fixed in GR runtime commit fe68d18331721809200b0e7fe5d1af814be27510 and the fix was release as part of GR runtime version 0.41.3.