[med-svn] [gdpc] 01/01: work on fixing segfault

Sascha Steinbiss satta at debian.org
Sun Jul 24 17:50:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

satta pushed a commit to branch master
in repository gdpc.

commit 42768e5b36d77f9561217c820db5a25d43f938ac
Author: Sascha Steinbiss <satta at debian.org>
Date:   Sun Jul 24 17:50:08 2016 +0000

    work on fixing segfault
---
 debian/patches/fix_segfault.patch | 337 ++++++++++++++++++++++++++++++++++++++
 debian/patches/series             |   1 +
 2 files changed, 338 insertions(+)

diff --git a/debian/patches/fix_segfault.patch b/debian/patches/fix_segfault.patch
new file mode 100644
index 0000000..a031edd
--- /dev/null
+++ b/debian/patches/fix_segfault.patch
@@ -0,0 +1,337 @@
+Description: try to fix segfault
+Author: Sascha Steinbiss <satta at debian.org>
+--- a/main.c
++++ b/main.c
+@@ -97,7 +97,7 @@
+ #endif
+ 
+     for (i=NUMFRAMES-1;i>=0;i--) {
+-	g_mutex_trylock(params->framedrawn[i]);
++	g_mutex_trylock(&params->framedrawn[i]);
+     }
+ 
+ #if Debug
+@@ -110,7 +110,7 @@
+ 	gtk_main_quit();
+     }
+     fseek(NewFP,SEEK_SET,0);
+-    g_mutex_unlock(params->atEnd);
++    g_mutex_unlock(&params->atEnd);
+     cleardrawable(DrawData);
+     params->numframe = 1;
+ 
+@@ -118,16 +118,16 @@
+ printf("Reinitialize filewait/frameready/framedrawn semaphores.\n"); 
+ #endif
+ 
+-    g_mutex_unlock(params->filewait);
++    g_mutex_unlock(&params->filewait);
+ 
+     for (i=NUMFRAMES-1;i>=0;i--) {
+-	g_mutex_trylock(params->frameready[i]);
++	g_mutex_trylock(&params->frameready[i]);
+     }
+ 
+     DrawData.NumFrame = NumFrameRI;
+ 
+     for (i=0;i<NUMFRAMES;i++) {
+-	g_mutex_unlock(params->framedrawn[i]);
++	g_mutex_unlock(&params->framedrawn[i]);
+     }
+ }
+ 
+@@ -363,7 +363,7 @@
+ 	|| params->zcolumn!=params->oldzc 
+ 	|| params->tcolumn!=params->oldtc ) {
+ 	fseek(params->fp,SEEK_SET,0);
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+ 	cleardrawable(DrawData);
+     }
+     if (strlen(params->file)>0) {
+@@ -375,7 +375,7 @@
+ 	    }
+         fseek(params->fp,0,0);
+ 	params->numframe=1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+ 	cleardrawable(DrawData);
+     }
+     else {
+@@ -450,7 +450,7 @@
+ 	   !params->setupstop && (!params->mbsleep || MB_pressed)) {
+ 	    params->drawcheck=FALSE;
+ 	    MB_pressed = FALSE;
+-	    if (g_mutex_trylock(params->frameready[DrawData.NumFrame])==TRUE) {
++	    if (g_mutex_trylock(&params->frameready[DrawData.NumFrame])==TRUE) {
+ 
+ #if Debug
+ printf("Calling drawing function.\n");
+@@ -541,7 +541,7 @@
+ 		}
+ 		params->numframe++;
+ 
+-		g_mutex_unlock(params->framedrawn[DrawData.NumFrame]);
++		g_mutex_unlock(&params->framedrawn[DrawData.NumFrame]);
+ 		DrawData.NumFrame++;
+ 		if (DrawData.NumFrame==NUMFRAMES) DrawData.NumFrame = 0;
+ 		params->drawcheck = TRUE;
+@@ -848,10 +848,10 @@
+ #endif
+ 
+   for (i=0;i<NUMFRAMES;i++) {
+-	g_mutex_init (params->frameready[i]);
+-	g_mutex_lock (params->frameready[i]);
+-	g_mutex_init (params->framedrawn[i]);
+-	g_mutex_unlock (params->framedrawn[i]);
++	g_mutex_init (&params->frameready[i]);
++	g_mutex_lock (&params->frameready[i]);
++	g_mutex_init (&params->framedrawn[i]);
++	/* g_mutex_unlock (&params->framedrawn[i]) */;
+ 	params->framedata[i] = NULL;
+     }
+     DrawData.NumFrame = 0;
+@@ -860,9 +860,9 @@
+ printf("Initialising filewait/EOF semaphores.\n");
+ #endif
+ 
+-    g_mutex_init (params->filewait);
+-    g_mutex_lock (params->filewait);
+-    g_mutex_init (params->atEnd);
++    g_mutex_init (&params->filewait);
++    g_mutex_lock (&params->filewait);
++    g_mutex_init (&params->atEnd);
+ 
+ #if Debug 
+ printf("Starting filereading thread.\n");
+--- a/parameters.h
++++ b/parameters.h
+@@ -177,10 +177,10 @@
+ gchar dumpname[50];		/* Names of dumped images */
+ gchar timedelim[20];		/* Delimiter for time readings in xyz-format */
+ FILE *fp;			/* File pointer */
+-GMutex *frameready[NUMFRAMES];	/* Control variables for 'Is the whole frame read?' */ 
+-GMutex *framedrawn[NUMFRAMES];	/* Control variables for 'Is the whole frame drawn?' */
+-GMutex *filewait;		/* Wait for file control variable */
+-GMutex *atEnd;			/* Whole file read in control variable */
++GMutex frameready[NUMFRAMES];	/* Control variables for 'Is the whole frame read?' */ 
++GMutex framedrawn[NUMFRAMES];	/* Control variables for 'Is the whole frame drawn?' */
++GMutex filewait;		/* Wait for file control variable */
++GMutex atEnd;			/* Whole file read in control variable */
+ gint frameanum[NUMFRAMES];	/* Number of atoms in a frame */
+ struct xyzstruc *framedata[NUMFRAMES];	/* Data of a frame */
+ double atime[NUMFRAMES];	/* Timestamp of a frame */
+--- a/readinput.c
++++ b/readinput.c
+@@ -62,8 +62,8 @@
+     framecheck = FALSE;
+ 
+     while(1) {
+-	g_mutex_lock(params->atEnd);
+-	g_mutex_lock(params->framedrawn[NumFrameRI]);
++	g_mutex_lock(&params->atEnd);
++	g_mutex_lock(&params->framedrawn[NumFrameRI]);
+ 
+ #if Debug
+ printf("Reading frame : %d\n",NumFrameRI);
+@@ -79,7 +79,7 @@
+ 	maxz=0.0;
+ 
+ 	if (NewFP != NULL) {
+-	    g_mutex_lock(params->filewait);
++	    g_mutex_lock(&params->filewait);
+ 	    params->fp = NewFP;
+ 	    NewFP = NULL;
+ 	    fclose(fpRI);
+@@ -95,7 +95,7 @@
+                 lastframedone=1;
+ 		continue;
+ 	    }
+-	    else g_mutex_unlock(params->atEnd);
++	    else g_mutex_unlock(&params->atEnd);
+ 
+ 		n=sscanf(buf,"%d",&nreadxyz);
+ 		if (n!=1) {
+@@ -233,7 +233,7 @@
+ 	    }
+ 	    
+ 	    params->numtypes=numtypes;
+-	    g_mutex_unlock(params->frameready[NumFrameRI]);
++	    g_mutex_unlock(&params->frameready[NumFrameRI]);
+ 	    NumFrameRI++;
+ 	    if (NumFrameRI==NUMFRAMES) NumFrameRI = 0;
+ 	    if (endframe) {
+@@ -348,13 +348,13 @@
+ 	    if (params->framedata[NumFrameRI] != NULL) 
+ 		g_free(params->framedata[NumFrameRI]);
+ 	    params->framedata[NumFrameRI] = coords;
+-	    g_mutex_unlock(params->frameready[NumFrameRI]);
++	    g_mutex_unlock(&params->frameready[NumFrameRI]);
+ 	    NumFrameRI++;
+ 	    if (NumFrameRI==NUMFRAMES) NumFrameRI=0;	
+ 	    if (endframe) {
+ 		framecheck = FALSE;
+ 	    }
+-	    else g_mutex_unlock(params->atEnd);
++	    else g_mutex_unlock(&params->atEnd);
+ 	}
+     }
+ }
+--- a/rotate.c
++++ b/rotate.c
+@@ -37,9 +37,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -52,9 +52,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -67,9 +67,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -82,9 +82,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -97,9 +97,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -112,9 +112,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -130,9 +130,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -145,9 +145,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -160,9 +160,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -175,9 +175,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -190,9 +190,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -205,9 +205,9 @@
+ {
+ gint getval;
+ 
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
+@@ -236,9 +236,9 @@
+ {
+ gint getval;
+     
+-    if (g_mutex_trylock(params->atEnd) == TRUE) {
++    if (g_mutex_trylock(&params->atEnd) == TRUE) {
+ 	getval = 1;
+-	g_mutex_unlock(params->atEnd);
++	g_mutex_unlock(&params->atEnd);
+     }
+     else getval = 0;
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 6cc64ee..7db23db 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 40_fix_gcc4.8_build.patch
 41_glib_deprecated_funcs.patch
 hardening.patch
+fix_segfault.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/gdpc.git



More information about the debian-med-commit mailing list