summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-24 20:04:41 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-24 20:04:41 +0000
commit1f4252160f3ba717e5aef16faaa3be4b8055b31e (patch)
tree7ac93051c43ee22e3c4d498a641e3cf3d27b2149
parent7f75324eb93999c0ea6528b9c1b66740599a1173 (diff)
download2012-violon-leds-1f4252160f3ba717e5aef16faaa3be4b8055b31e.tar.gz
2012-violon-leds-1f4252160f3ba717e5aef16faaa3be4b8055b31e.tar.bz2
2012-violon-leds-1f4252160f3ba717e5aef16faaa3be4b8055b31e.zip
Correction segfault a la fermeture si module USB<->DMX non present
git-svn-id: file:///var/svn/2012-violon-leds/trunk@32 6be1fa4d-33ac-4c33-becc-79fcb3794bb6
-rw-r--r--src/Makefile4
-rw-r--r--src/illuminate.c3
-rw-r--r--src/instru2light.c7
3 files changed, 9 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile
index 17b646f..d4f0979 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,10 +1,10 @@
CC=gcc
# For debug
-#CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -g
+CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -g
#LDFLAGS=-Werror -g
# For release
-CFLAGS=-W -Wall -Werror -Wno-unused-parameter -O2
+#CFLAGS=-W -Wall -Werror -Wno-unused-parameter -O2
LDFLAGS=-export-dynamic -Werror
EXEC=instru2light
diff --git a/src/illuminate.c b/src/illuminate.c
index b3afbfb..d5d40b2 100644
--- a/src/illuminate.c
+++ b/src/illuminate.c
@@ -75,7 +75,8 @@ int dmx_init() {
//Always take the first device
if (devlist==NULL || devlist->dev==NULL) {
fprintf(stderr, "No usb device detected (looking for USB ID 0x%04X:0x%04X)\n", VID, PID);
- return(2);
+ ftdi_deinit(&ftdi);
+ return 1;
}
dev=devlist->dev;
diff --git a/src/instru2light.c b/src/instru2light.c
index 33892b5..a72fd0f 100644
--- a/src/instru2light.c
+++ b/src/instru2light.c
@@ -29,6 +29,8 @@ gint *audio_vumeter_val, *light_h, *light_s, *light_v, *light_r, *light_g, *ligh
void my_process(float *data, size_t nsamples, size_t nchan);
int main (int argc, char **argv) {
+ int dmx_init_res;
+
GtkWidget *mainwin;
gint vals_for_vumeters[7]={0,0,0,0,0,0,0}; //sound,h,s,v,r,g,b
//Some handy references to the previous array items to make things clear whenever possible
@@ -50,7 +52,7 @@ int main (int argc, char **argv) {
mainwin=win_main_build();
gtk_widget_show_all (mainwin);
- dmx_init();
+ dmx_init_res=dmx_init();
printf("debug : main my_process==%p\n", my_process);
printf("debug : main (void *)my_process==%p\n", (void *)my_process);
@@ -60,7 +62,8 @@ int main (int argc, char **argv) {
gtk_main ();
gdk_threads_leave();
- dmx_deinit();
+
+ if (dmx_init_res==0) dmx_deinit();
return 0;
}