-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Description
The following Python code defines a simple dummy plugin, creates a new layout, and then registers the plugin. Running it crashes the KLayout application since 0.28 (tested to crash on 0.28.2, verified that this worked on the last version of 0.27).
import pya
class DummyPlugin(pya.Plugin):
def __init__(self, manager, view):
self.manager = manager
self.view = view
class DummyPluginFactory(pya.PluginFactory):
def __init__(self):
self.register(1000, "dummy_plugin", "Dummy Plugin")
def create_plugin(self, manager, _, view):
return DummyPlugin(manager, view)
# Create a new layout
main_window = pya.MainWindow.instance()
main_window.create_layout(2)
# Register plugin
DummyPluginFactory()Reversing the order, i.e. calling DummyPluginFactory() before main_window.create_layout(2), works fine.
So there is a workaround, just make sure the plugins are registered before any layouts are created. Since this is a hard crash and new behavior in 0.28 I still report it as bug.
Reactions are currently unavailable