Closed falkTX closed 1 year ago
You are indeed not allowed to call clap_plugin::get_extension()
before clap_plugin::init()
has been called, just like the plugin isn't allowed to call clap_host::get_extension()
before the host calls clap_plugin::init()
.
So we must call the
destroy
method, but is it valid to destroy the plugin (or do any other calls) before callinginit
?
You can technically call clap_plugin::destroy()
immediately after creating it without calling init()
first, but there's be no reason to do that.
good points. I think mentioning this directly in the header docs is worthwhile.
clap has very strict rules when it comes to threading, the same should be true for the calling order too. will do a PR later if no one else does by then.
I am seeing a few plugins crash under these conditions:
clap_plugin_t
pointerget_extension
to figure out details of the plugin, seeing if it is compatibleinit
as needed, otherwisedestroy
as the plugin is not wantedFor some plugins, the
get_extension
call before ainit
is triggering a segmentation fault crash.Documentation for the plugin factory creation method states:
So we must call the
destroy
method, but is it valid to destroy the plugin (or do any other calls) before callinginit
? The init docs say:But IMO such comment should be on the plugin factory side as well. From reading the plugin factory comments, we are lead to think we can create a plugin and simply destroy it afterwards.