Lets try to track the actually problem.
The
List index (0) out of bounds
is obviously due to a wrong initialization or usage of Form1.ImageCount
When setting it, you use it as count:
Form1.ImageCount:=0;
but when using it, you use it like "high", highest element, that is count - 1:
ImageList.Strings[Form1.ImageCount]
Because in an empty list (count = 0) there is no element with index 0.
There are more places that use it as "high":
ImageCount := ImageList.Count -1
But even then I see no checks not to access ImageList.Strings, if the value is -1
So that, I would guess is broken in your code, and would fail with Lazarus 1.2 too, *IF* the list was empty.
----
If I understand, in Lazarus 1.2 the list is never empty.
While in Lazarus 1.4 it is empty, even though you supply the SAME PATH, and it has the same content?
Now then it was already pointed out that the likeliest candidate for this is
Form1.ImageList := FindAllFiles(ExtractFilePath(Form1.ImageFile), '*.jpg;*.png', false);
Now to find out what is causing it more data is needed:
- I may have missed it, but your OS is?
- The content of Form1.ImageFile is ?
- The result of "ExtractFilePath(Form1.ImageFile)" is?
- And after this "Form1.ImageList.Count" is 0 ?
To find the values, please add some lines to output (message dialog, logfile, console (debugln)...) the values above.
Maybe the path contains some sequence of chars, that triggers a problem?
One think I found by looking at the diff between 1.2 and 1.4 is that the possibility was added for FindAllFiles, to take a ";" separated list. (If I read the logs correct)
If I understood it correct, that would break any code where the path actually contains a ";", because it would now be split as to paths.
There may be other changes, but I did not spot any (yet). So having actual data, that causes an issue is the next step.