Hey S.O! I am posting my stack overflow problem to StackOverflow.com. Irony at its best!
Anyway. I call this procedure on my SkypeReply event handler, which gets fired a lot:
Procedure OnCategoryRename; Var CategoryID : Integer; sCtgName : String; Begin if (AnsiContainsStr(pCommand.Reply,'GROUP')) and (AnsiContainsStr(pCommand.Reply,'DISPLAYNAME')) then begin sCtgName := pCommand.Reply; Delete(sCtgName,1,Pos('GROUP',sCtgName)+5); CategoryID := StrToInt(Trim(LeftStr(sCtgName,Pos(' ',sCtgName)))); sCtgName := GetCategoryByID(CategoryID).DisplayName; // Removing THIS line does not produce a Stack Overflow! ShowMessage(sCtgName); end;
The idea behind this is to scroll through my list of Skype groups to see which group has been renamed. AFAIK that doesn't matter since my SO has been traced to appear here
Function GetCategoryByID(ID : Integer):IGroup; Var I : Integer; Category : IGroup; Begin // Make the default result nil Result := nil; // Loop thru the CUSTOM CATEGORIES of the ONLY SKYPE CONTROL used in this project // (which 100% positive IS attached ;) ) for I := 1 to frmMain.Skype.CustomGroups.Count do Begin // The Category Variable Category := frmMain.Skype.CustomGroups.Item[I]; // If the current category ID returned by the loop matches the passed ID if Category.Id = ID then begin // Return the Category as Result (IGroup) Result := Category; // Exit the function. Exit; end; End; End;
When I set a breakpoint in Result: = Category; and Single Step thru, these two lines run again and again, right after each other!
And when I comment sCtgName := GetCategoryByID(CategoryID).DisplayName; in the first piece of code, there is no overflow, a message appears that it should once. However, GetCategoryByID is a function that I wrote, and I wrote one similar one that works fine (GetCategoryByName), so I don’t understand why he decided to repeat
again and again.
If you need more information, feel free to ask!
EDIT: here is how you can reproduce it: https://gist.github.com/813389
EDIT: Here is my CallStack, as requested: 
Edit2: Additional Information: 
Thank you for your time! - Jeff