diff options
author | Thomas White <taw@physics.org> | 2010-10-08 18:13:11 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:02 +0100 |
commit | a026279385d4b67682b13b100083ef708eaf6280 (patch) | |
tree | a902d64491d5836d616496f66164d237ff70a369 /src/facetron.c | |
parent | f7be30c4e727ad517bd3bf1ee3dde914c01910ea (diff) |
facetron: Fix careless deletion
Grr.
Diffstat (limited to 'src/facetron.c')
-rw-r--r-- | src/facetron.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/facetron.c b/src/facetron.c index 55acb645..bd7f58ed 100644 --- a/src/facetron.c +++ b/src/facetron.c @@ -99,9 +99,6 @@ static void integrate_image(struct process_args *pargs) struct hdfile *hdfile; struct image *image = pargs->image; - image->data = NULL; - image->flags = NULL; - hdfile = hdfile_open(image->filename); if ( hdfile == NULL ) { ERROR("Couldn't open '%s'\n", image->filename); @@ -118,8 +115,6 @@ static void integrate_image(struct process_args *pargs) return; } -goto skip; - /* Figure out which spots should appear in this pattern, * using a large divergence and bandwidth to avoid missing * reflection tails. */ @@ -161,11 +156,14 @@ goto skip; } -skip: free(image->data); if ( image->flags != NULL ) free(image->flags); hdfile_close(hdfile); - //free(spots); + free(spots); + + /* Muppet proofing */ + image->data = NULL; + image->flags = NULL; } @@ -178,6 +176,11 @@ static void *worker_thread(void *pargsv) int wakeup; + /* Acknowledge start */ + pthread_mutex_lock(&pargs->control_mutex); + pargs->start = 0; + pthread_mutex_unlock(&pargs->control_mutex); + pargs->func(pargs); pthread_mutex_lock(&pargs->control_mutex); @@ -279,7 +282,9 @@ static void munch_threads(struct image *images, int n_total_patterns, if ( !done ) continue; /* Reset "done" flag */ + pthread_mutex_lock(&pargs->control_mutex); pargs->done = 0; + pthread_mutex_unlock(&pargs->control_mutex); n_done++; progress_bar(n_done, n_total_patterns, text); @@ -530,6 +535,10 @@ int main(int argc, char *argv[]) images[i].orientation.z = 0.0; images[i].det = det; + /* Muppet proofing */ + images[i].data = NULL; + images[i].flags = NULL; + free(filename); progress_bar(i, n_total_patterns-1, "Loading pattern data"); |