FIXED
Well, at least that's how it SEEMS for now
I was looking in the wrong place completely. I'm not going to rule out any possible bugs with the memory allocation just yet as I did get crashes with FB's code originally - whether my comp was just having a funny turn I don't know, but I've ran it since and it seems stable.
The problem that was screwing my strings up I have traced back to a single line, in a place I never thought to check (always the case isn't it?)
I have a CompilerIf that checks a constant called #GUI_SYSTEM_DEBUG, in the render procedure. Within this block is a chunk of code that just writes all the info that might be of use to the screen - ie all the structure info for the current panel, mouse coordinates, clicked buttons, FPS, list index etc etc.
Since I ran out of ideas I just tried running without the debug output to see if that affected anything. All of a sudden, I can't recreate the dodgy string problem (I had managed to figure out a series of clicks that would cause it to screw up, it'd happened that many times

) anymore
So I guessed it was down to my GetInfo function, which is called like this: GUI_PANEL_GetInfo(GUI_PANEL_MouseOver()). The mouseover procedure runs through the linked list from last element (topmost panel) to first (bottom) and checks if the mouse is in the current panel's rect - if it is, it returns the handle/LL element, otherwise it returns zero.
GetInfo was checking if the handle passed to it was <> #NULL. If it was, it simply created a string with no info taken from a structure, so on the screen it would display H_PANEL:, Sprite:, X pos:, Y pos: etc etc but no info next to them. Each of these "headers" is \n terminated so the whole string is listed down the side of the screen. If the passed parameter was nonzero, it then looped through the list AGAIN looking for the handle provided until found, then filled a string with all the info required. I thought it wasn't a good idea to be looping through the list so often... and I thought it was overkill to be looping in the GetInfo procedure. I changed the code so that if the parameter passed was nonzero, it would ChangeCurrentElement() to the one that was passed. Again it would fill the string with info.
I ran the code again but the problem was still there... so I commented out the code that fills the string with info and bingo... problem solved. So the string error for some reason was caused by this line:
Code: Select all
GUI_PANEL_INFO = "H_Panel: " + Str(GUI_LIST_PANEL()\H_Panel) + "\nSprite: " + Str(GUI_LIST_PANEL()\Sprite[#GUI_PANEL_SPRITE_AREA]) + "\nHeader: " + GUI_LIST_PANEL()\Header + "\nPanel top left X: " + Str(GUI_LIST_PANEL()\PanelRECT\X1) + "\nPanel top left Y: " + Str(GUI_LIST_PANEL()\PanelRECT\Y1) + "\nPanel bottom right X: " + Str(GUI_LIST_PANEL()\PanelRECT\X2) + "\nPanel bottom right Y: " + Str(GUI_LIST_PANEL()\PanelRECT\Y2)+ "\nArea top left X: " + Str(GUI_LIST_PANEL()\AreaRECT\X1) + "\nArea top left Y: " + Str(GUI_LIST_PANEL()\AreaRECT\Y1) + "\nArea bottom right X: " + Str(GUI_LIST_PANEL()\AreaRECT\X2) + "\nArea bottom right Y: " + Str(GUI_LIST_PANEL()\AreaRECT\Y2) + "\nSize X: " + Str(GUI_LIST_PANEL()\Width) + "\nSize Y: " + Str(GUI_LIST_PANEL()\Height) + "\nColour: " + Str(GUI_LIST_PANEL()\Colour) + "\nActive: " + Str(GUI_LIST_PANEL()\Active) + "\nDragging: " + Str(GUI_LIST_PANEL()\Dragging)
I need to figure a way around this because the GetInfo function is quite important for retrieving information from a structure... I'm also hoping that there is nothing wrong with the mouseover proc either.... but ah well, I'll worry about those when they go wrong
