osxrules
09-03-2007, 01:54 AM
I've come across some very strange behaviour in Shake after programming a few macros. If I call functions and return values in certain ways, it cause Shake to crash with a segmentation fault.
One example is if I do
float correct_quadrant(float a, float x1, float y1, float x2, float y2){
if(x2<x1 && y2>y1) return a;
}
image curve_path(...){
...
grad1 = correct_quadrant(grad1,x1,y1,x2,y2);
...
}
This crashes Shake immediately on adding the node and there are references to getVal() and asFloat() in the crash. If however, I add the code from the external function directly into the main one, it's fine and doesn't crash.
I thought that it maybe wasn't picking up the float type from the function argument and indeed when I change the function to:
float correct_quadrant(float a, float x1, float y1, float x2, float y2){
float value = a;
if(x2<x1 && y2>y1) value=a;
return value;
}
it doesn't crash. However, I tried other functions similar to the second one and as I'm using the node, it will crash completely at random times with the same crash error about getVal() asFloat(). When I remove the external function, it seems to be stable but I need to use external functions.
I guess I should just submit another bug report to Apple but I was wondering if any Macro developers had come across this before. I find that some 3rd party Macros will crash Shake at random too and I suspect it's a similar issue.
One example is if I do
float correct_quadrant(float a, float x1, float y1, float x2, float y2){
if(x2<x1 && y2>y1) return a;
}
image curve_path(...){
...
grad1 = correct_quadrant(grad1,x1,y1,x2,y2);
...
}
This crashes Shake immediately on adding the node and there are references to getVal() and asFloat() in the crash. If however, I add the code from the external function directly into the main one, it's fine and doesn't crash.
I thought that it maybe wasn't picking up the float type from the function argument and indeed when I change the function to:
float correct_quadrant(float a, float x1, float y1, float x2, float y2){
float value = a;
if(x2<x1 && y2>y1) value=a;
return value;
}
it doesn't crash. However, I tried other functions similar to the second one and as I'm using the node, it will crash completely at random times with the same crash error about getVal() asFloat(). When I remove the external function, it seems to be stable but I need to use external functions.
I guess I should just submit another bug report to Apple but I was wondering if any Macro developers had come across this before. I find that some 3rd party Macros will crash Shake at random too and I suspect it's a similar issue.
