summaryrefslogtreecommitdiff
path: root/cubedbus.c
diff options
context:
space:
mode:
authorJoel Bosveld <joel@JOEL-UBUNTU.(none)>2007-11-14 16:00:24 +0900
committerJoel Bosveld <joel@JOEL-UBUNTU.(none)>2007-11-14 16:00:24 +0900
commitbbf78644d2fb9972d60fd22399fa7760d25428f9 (patch)
treecb65d0c5add40d84178764cd9637964ca8a6d651 /cubedbus.c
parent2d01bb5ac05fd1eb0e5513d77fd5f5ead7c239ec (diff)
downloadcubedbus-bbf78644d2fb9972d60fd22399fa7760d25428f9.tar.gz
cubedbus-bbf78644d2fb9972d60fd22399fa7760d25428f9.tar.bz2
Fixed crash when adding a second object
Diffstat (limited to 'cubedbus.c')
-rw-r--r--cubedbus.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/cubedbus.c b/cubedbus.c
index c9cb93c..ae8a484 100644
--- a/cubedbus.c
+++ b/cubedbus.c
@@ -66,12 +66,6 @@ cubedbusAddObject (CompDisplay *d,
s = findScreenAtDisplay (d, xid);
CUBEDBUS_SCREEN(s);
- compLogMessage (NULL, "cubedbus", CompLogLevelWarn, "Adding Object");
-
- GLint err;
- while((err=glGetError())){
- compLogMessage (NULL, "cubedbus", CompLogLevelError, "before %d",err);}
-
CubedbusObject *objptr;
objptr=gs->head;
@@ -79,7 +73,11 @@ cubedbusAddObject (CompDisplay *d,
if (gs->head == NULL)
{
gs->head = malloc (sizeof(CubedbusObject));
- if(gs->head == NULL) return FALSE;
+ if(gs->head == NULL)
+ {
+ compLogMessage (NULL, "cubedbus", CompLogLevelError, "Out of memory. Could not add object");
+ return FALSE;
+ }
objptr=gs->head;
objptr->prev = NULL;
}
@@ -90,9 +88,16 @@ cubedbusAddObject (CompDisplay *d,
if(objptr->next == NULL )
{
objptr->next = malloc (sizeof(CubedbusObject));
- if(objptr->next == NULL) return FALSE;
+ if(objptr->next == NULL)
+ {
+ compLogMessage (NULL, "cubedbus", CompLogLevelError, "Out of memory. Could not add object");
+ return FALSE;
+ }
objptr->next->prev=objptr;
- objptr=objptr->next; /* objptr now points to newly created object */
+ objptr=objptr->next; /* objptr now points to newly created object */
+
+ compLogMessage (NULL, "cubedbus", CompLogLevelWarn, "created obj");
+ break;
}
else objptr=objptr->next;
}
@@ -110,7 +115,6 @@ cubedbusAddObject (CompDisplay *d,
{
case CUBEDBUS_COLOUR_OBJECT:
{
- compLogMessage (NULL, "cubedbus", CompLogLevelWarn, "Adding ColourObject");
objptr->func=&cubedbusDrawColourObject;
objptr->data= malloc( sizeof(CubedbusColourObject) );
@@ -130,7 +134,6 @@ cubedbusAddObject (CompDisplay *d,
colourData->scale[2]=getFloatOptionNamed (option,nOption, "scaleZ", 1.0);
colourData->order=getBoolOptionNamed (option, nOption, "order", TRUE);
- compLogMessage (NULL, "cubedbus", CompLogLevelWarn, "translate %f", colourData->translate[0]);
/* Code to make dList */
@@ -148,7 +151,7 @@ cubedbusAddObject (CompDisplay *d,
for(i=0;i</*num*/3;i++)
{
sprintf(string,"r%d",i);
- r=getFloatOptionNamed (option, nOption, string, 1.0 );
+ r=getFloatOptionNamed (option, nOption, string, 0.0 );
sprintf(string,"g%d",i);
g=getFloatOptionNamed (option, nOption, string, 0.0 );
sprintf(string,"b%d",i);