Skip to content
Snippets Groups Projects
Commit f7b89e25 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

lal_simulation:

- lock the element in the property get/set methods
- don't forget to free the document structure
parent 0bec8be5
No related branches found
No related tags found
No related merge requests found
......@@ -94,12 +94,14 @@ static void destroy_injection_document(struct injection_document *doc)
{
if(doc) {
XLALDestroySimBurstTable(doc->sim_burst_table_head);
doc->sim_burst_table_head = NULL;
while(doc->sim_inspiral_table_head) {
SimInspiralTable *next = doc->sim_inspiral_table_head->next;
XLALFree(doc->sim_inspiral_table_head);
doc->sim_inspiral_table_head = next;
}
}
g_free(doc);
}
......@@ -120,7 +122,7 @@ static struct injection_document *load_injection_document(const char *filename,
* allocate the document
*/
new = calloc(1, sizeof(*new));
new = g_new0(struct injection_document, 1);
if(!new) {
XLALPrintError("%s(): malloc() failed\n", __func__);
XLAL_ERROR_NULL(XLAL_ENOMEM);
......@@ -686,6 +688,8 @@ static void set_property(GObject *object, enum property id, const GValue *value,
GSTLALSimulation *element = GSTLAL_SIMULATION(object);
GST_OBJECT_LOCK(element);
switch(id) {
case ARG_XML_LOCATION:
g_free(element->xml_location);
......@@ -698,12 +702,16 @@ static void set_property(GObject *object, enum property id, const GValue *value,
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, pspec);
break;
}
GST_OBJECT_UNLOCK(element);
}
static void get_property(GObject *object, enum property id, GValue *value, GParamSpec *pspec)
{
GSTLALSimulation *element = GSTLAL_SIMULATION(object);
GST_OBJECT_LOCK(element);
switch(id) {
case ARG_XML_LOCATION:
g_value_set_string(value, element->xml_location);
......@@ -725,6 +733,8 @@ static void get_property(GObject *object, enum property id, GValue *value, GPara
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, pspec);
break;
}
GST_OBJECT_UNLOCK(element);
}
......@@ -910,6 +920,7 @@ static void finalize(GObject * object)
g_free(element->xml_location);
element->xml_location = NULL;
destroy_injection_document(element->injection_document);
element->injection_document = NULL;
g_free(element->instrument);
element->instrument = NULL;
g_free(element->channel_name);
......
......@@ -50,18 +50,6 @@ typedef struct {
struct GSTLALInjectionCache;
struct GSTLALInjectionCache {
LIGOTimeGPS startTime;
LIGOTimeGPS endTime;
REAL4TimeSeries *series;
double underflow_protection;
SimInspiralTable *sim_inspiral;
SimInspiralTable *sim_inspiral_pointer;
SimBurst *sim_burst;
SimBurst *sim_burst_pointer;
struct GSTLALInjectionCache *next;
};
typedef struct {
GstElement element;
......@@ -81,7 +69,17 @@ typedef struct {
char *channel_name;
char *units;
struct GSTLALInjectionCache *injection_cache;
struct GSTLALInjectionCache {
LIGOTimeGPS startTime;
LIGOTimeGPS endTime;
REAL4TimeSeries *series;
double underflow_protection;
SimInspiralTable *sim_inspiral;
SimInspiralTable *sim_inspiral_pointer;
SimBurst *sim_burst;
SimBurst *sim_burst_pointer;
struct GSTLALInjectionCache *next;
} *injection_cache;
} GSTLALSimulation;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment