It looks like you're new here. If you want to get involved, click one of these buttons!
Hi mathias,
I'm not sure if it is a bug:
I have a script like this and i think it has problem
lv = pya.Application.instance().main_window().current_view()
marker = pya.Marker(lv)
marker._destroy
marker.set(pya.DBox.new(0.0, 0.0, 100.0, 200.0))
i make it and close klayout after that i can not open the application,it show "Application Crashed"
when i remove this script Klayout run normally.
daipv
Comments
why would you
_destory
before.set
? I think you are trying to use a pointer to a piece of memory you just released.I think that @jheinsoo is right - "_destroy" should only be used in rare cases, when you explicitly want to release resources for a big object such as a Layout.
And it looks like the script was saved with "Autorun" on, so it will always run and give the crash.
Most objects are safe and won't crash after _destroy - they will just raise an error. But as this comes with some overhead, lightweight objects such as a marker don't make an effort to be safe in this respect.
Matthias
I got it ,jheinsoo and Matthias.
I should check if 'lv' is None or not before 'marker = pya.Marker(lv)' also
Thank you very much
daipv