Author |
Topic |
|
yogiyang
India
727 Posts |
Posted - Nov 09 2019 : 05:21:46
|
Hello,
I installed the latest version if IE which is 8.7.5 on my system and opened an existing project which is compiling and working properly in 8.6.0 is not working properly.
First problem that I faced is that the IDE shows error in the component TMSScripter related module code at compile time.
So I removed TMSScripter and all its related modules. After this the application compiled properly but I started getting error when we close the application.
On debugging in the IDE, it points to this code in iemview.pas module:
procedure TImageEnMView.SetThumbnailClipping(Value: Integer);
begin
if fThumbnailClipping <> Value then
begin
fThumbnailClipping := Value;
ClearCache;
UpdateEx( True );
end;
end;
I am using Delphi 10 Seattle.
How to solve this problem?
TIA
Yogi Yang |
|
xequte
38610 Posts |
Posted - Nov 09 2019 : 15:30:12
|
Hi Yogi
Can you reproduce in any of our demos?
What is the error that you get? On which particular line?
Nigel Xequte Software www.imageen.com
|
|
|
yogiyang
India
727 Posts |
Posted - Nov 10 2019 : 00:17:50
|
I have not tested the samples/demos. Will try them out.
The error is on this line:
if fThumbnailClipping <> Value then
The error I get is a cryptic memory location.
TIA
Yogi Yang |
|
|
xequte
38610 Posts |
Posted - Nov 10 2019 : 13:56:43
|
Hi Yogi
That implies you are calling:
ImageEnMView1.ThumbnailClipping := ...;
After you have freed it.
Nigel Xequte Software www.imageen.com
|
|
|
yogiyang
India
727 Posts |
Posted - Nov 11 2019 : 07:52:54
|
Hello Nigel,
I checked my code I am not trying to reference ImageEnMView anywhere at form close event.
Here is the code that I am using:
if fSourceBitmap <> nil then
FreeAndNil(fSourceBitmap);
if fSourceImg <> nil then
FreeAndNil(fSourceImg);
if lstSelectedPFName <> nil then
FreeAndNil(lstSelectedPFName);
if lstSelectedLFName <> nil then
FreeAndNil(lstSelectedLFName);
if lstQckINIFile <> nil then
FreeAndNil(lstQckINIFile);
if fSourceBitmap <> nil then
FreeAndNil(fSourceBitmap);
if FadeEffectImage <> nil then
FreeAndNil(FadeEffectImage);
if IsDirty then
begin
dResult := MessageDlg
('Current Design is not saved. Do you sure you want to Save it?',
TMsgDlgType.mtConfirmation, mbYesNoCancel, 0);
if dResult = mrYes then
begin
// Save the document
end;
if dResult = mrCancel then
begin
CanClose := False;
exit;
end;
end;
TIA
Yogi Yang |
|
|
yogiyang
India
727 Posts |
Posted - Nov 11 2019 : 07:57:01
|
Hello Nigel,
I have such a code in the Change event of ImageEnMView control:
procedure TMainForm.iemPhotosChanged(Sender: TObject);
begin
iemPhotos.ThumbnailClipping := 10;
iemPhotos.HorizBorder := 15;
iemPhotos.Update;
end;
Yogi Yang |
|
|
yogiyang
India
727 Posts |
Posted - Nov 11 2019 : 08:09:33
|
Hello Nigel,
After a bit more experimentation I found that we remove/comment the code line
iemPhotos.ThumbnailClipping := 10; for all ImageEnMView controls in out project this error goes away.
But this is actually not a solution in my case because if we want to use ThumbnailClipping we cannot use it.
Can you please look into this and help solve it.
TIA
Yogi Yang |
|
|
xequte
38610 Posts |
Posted - Nov 11 2019 : 19:55:56
|
Hi Yogi
So, is the following method being called as/after the TImageEnMView is being destroyed?
E.g. if you put an exit at the start of this method, does the error go away?
procedure TMainForm.iemPhotosChanged(Sender: TObject);
Nigel Xequte Software www.imageen.com
|
|
|
yogiyang
India
727 Posts |
Posted - Nov 12 2019 : 00:35:01
|
Hello Nigel,
The code I have posted is of the change event of ImageEnMView control.
Yes commenting out this particular line: iemPhotos.ThumbnailClipping := 10; the error goes away.
But the funny thing is that this code exist from a long time and it has worked properly till date, that is till 8.6.x. It has started giving error only in 8.7.x.
TIA
Yogi Yang |
|
|
xequte
38610 Posts |
Posted - Nov 12 2019 : 18:22:21
|
Hi Yogi
The bug here is that the OnChanged event should not be called from the destructor. That is just poor form. I will have a fix in the next update.
Though, why do you set properties in the Changed event? That is an odd place for it. Why not in your FormCreate or FormShow event, for example?
Nigel Xequte Software www.imageen.com
|
|
|
yogiyang
India
727 Posts |
Posted - Nov 12 2019 : 23:35:29
|
Hello Nigel,
Though, why do you set properties in the Changed event? That is an odd place for it. Why not in your FormCreate or FormShow event, for example?
Well in past the settings (ThumbnailClipping and HorizBorder) were getting reset every time we cleared ImageEnMView and reloaded it by using FillFromDirectory or by adding one file at a time programatically, so while experimenting we found that setting these in the change event it was a guarantee that it will have the required effect.
TIA
Yogi Yang |
|
|
|
Topic |
|