Skip to content
Permalink
Browse files
LadspaEffect/TAP: fix instantiation/destruction
Instead of relying on naming the init functions _init() and _fini()
declare them as constructors/destructors and use a different name so
there's no double destruction

Closes #668.
  • Loading branch information
tobydox committed May 1, 2014
1 parent 5325e63 commit 83c20196117f0b3519479c7bb736bc1a45e19619
@@ -233,10 +233,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

int i;
char ** port_names;
@@ -341,9 +341,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -436,10 +436,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -575,9 +575,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -349,10 +349,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

int i;
char ** port_names;
@@ -471,9 +471,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -574,10 +574,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -717,9 +717,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -516,10 +516,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -646,9 +646,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -696,10 +696,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -857,9 +857,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -436,10 +436,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -607,9 +607,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -494,7 +494,7 @@ run_adding_eq(LADSPA_Handle instance, unsigned long sample_count) {


void
_init() {
__attribute__((constructor)) tap_init() {

char **port_names;
LADSPA_PortDescriptor *port_descriptors;
@@ -765,7 +765,7 @@ void


void
_fini() {
__attribute__((destructor)) tap_fini() {

if (eqDescriptor) {
free((LADSPA_PortDescriptor *)eqDescriptor->PortDescriptors);
@@ -596,7 +596,7 @@ run_adding_eq(LADSPA_Handle instance, unsigned long sample_count) {


void
_init() {
__attribute__((constructor)) tap_init() {

char **port_names;
LADSPA_PortDescriptor *port_descriptors;
@@ -955,7 +955,7 @@ void


void
_fini() {
__attribute__((destructor)) tap_fini() {

if (eqDescriptor) {
free((LADSPA_PortDescriptor *)eqDescriptor->PortDescriptors);
@@ -324,10 +324,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -423,9 +423,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -225,10 +225,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -325,9 +325,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -418,10 +418,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

int i;
char ** port_names;
@@ -536,9 +536,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -378,10 +378,10 @@ LADSPA_Descriptor * mono_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

int i;
char ** port_names;
@@ -480,9 +480,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

@@ -665,10 +665,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -815,9 +815,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -624,10 +624,10 @@ LADSPA_Descriptor * stereo_descriptor = NULL;



/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

int i;
char ** port_names;
@@ -748,9 +748,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(stereo_descriptor);
}

@@ -228,10 +228,10 @@ cleanup_Sigmoid(LADSPA_Handle Instance) {
LADSPA_Descriptor * mono_descriptor = NULL;


/* _init() is called automatically when the plugin library is first
/* __attribute__((constructor)) tap_init() is called automatically when the plugin library is first
loaded. */
void
_init() {
__attribute__((constructor)) tap_init() {

char ** port_names;
LADSPA_PortDescriptor * port_descriptors;
@@ -318,9 +318,9 @@ delete_descriptor(LADSPA_Descriptor * descriptor) {
}


/* _fini() is called automatically when the library is unloaded. */
/* __attribute__((destructor)) tap_fini() is called automatically when the library is unloaded. */
void
_fini() {
__attribute__((destructor)) tap_fini() {
delete_descriptor(mono_descriptor);
}

0 comments on commit 83c2019

Please sign in to comment.