mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-07 03:21:34 +02:00
Fixed issue #1242 (KLayout 0.28.2 crashes when registering a plugin if a layout exists)
Problem was twofold: first, events are triggered during construction of the plugin which met an uninitialized pointer. Second, the clearing of existing plugins failed because of iterating a vector while destroying it's members erased member of it.
This commit is contained in:
@@ -578,10 +578,11 @@ void LayoutViewBase::drop_url (const std::string &path_or_url)
|
||||
|
||||
void LayoutViewBase::clear_plugins ()
|
||||
{
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
std::vector<lay::Plugin *> plugins;
|
||||
mp_plugins.swap (plugins);
|
||||
for (std::vector<lay::Plugin *>::iterator p = plugins.begin (); p != plugins.end (); ++p) {
|
||||
delete *p;
|
||||
}
|
||||
mp_plugins.clear ();
|
||||
mp_active_plugin = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user