Hello!
I've noticed some exceedingly strange behaviour (possibly) related to
gfx_setimgdim.
Here's some code I use to resize an image, based on various properties, along with the positive/negative results I'm getting:
Code:
// the following code works completely fine...
source = this.getImageSource();
width = this.getWidth();
height = this.getHeight();
gfx_setimgdim(source, width, height);
// as does this...
function setImageDimensions(source, width, height) (
gfx_setimgdim(source, width, height);
);
setImageDimensions(this.getImageSource(), this.getWidth(), this.getHeight());
// but this one (sometimes) doesn't...
gfx_setimgdim(this.getImageSource(), this.getWidth(), this.getHeight());
As you can see, the input values are being calculated correctly but sometimes they don't make it through the function call. In particular, I've noticed these two bizarre behaviours at various times:
- the result of the first "this"-based calculation is also piped into all other this.xxx values: e.g. a non-"this" source followed by a "this" width also sets the height to this width, with little regard for their actual values, or
- all such values are sent as 0
I haven't been able to replicate this behaviour consistently in isolated tests, so maybe it's something to do with concurrency issues during the long evaluation time of arguments, something silly that I'm doing (always a danger) and/or maybe some stack wobbliness? These getter functions involve a few layers of nesting and some fairly hefty string manipulation.
I'm using the wrapped function technique to solve the problem but this does seem weird, right?
Any ideas?