[Solved] WFX with custom fields - unknown problem, need help

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I'm sorry, I have been too busy to check your problem yet. Did you try whether it works with any other plugins?
Author of Total Commander
https://www.ghisler.com
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

ghisler(Author) wrote:I'm sorry, I have been too busy to check your problem yet. Did you try whether it works with any other plugins?
I'm not sure what plugins did you mean.
Other WFX plugins - yes, they are working with custom columns normally.
Other my WFX plugins - I have no plugins written by me yet. :)
Praemonitus praemunitus
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Other WFX plugins - yes, they are working with custom columns normally.
Yes, that's what I meant - so the problem must be with your plugin, not with Total Commander.

Btw, the missing names usually mean that you have defined a color by file type which is the same as the background color (white).
Author of Total Commander
https://www.ghisler.com
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

What this can be?
---------------------------
Total Commander 8.0Я6
---------------------------
Access violation at address 01D27BF1. Read of address 00000000.
Access violation at address 01D27BF1. Read of address 00000000
Windows XP SP3 5.1 (Build 2600)

Please report this error to the Author, with a description
of what you were doing when this error occurred!

Windows exception: C0000005
Stack trace:
01D27BF1
67D9C8 67DB0F 67F074 683CCF 4E37CA 63B571
638F14 5DB438 64D6BF 4D8A2D 4D9B70 630E9D
443E44 443CF1 4452C5 443C2F 445FF6 443CF1
445C42 >423680 445203 423680 445171 423680
4452C5 445C42 423680 445203 423680 428D4C
428DE4 6CE327
Raw:
67D9C8 40208E 402235 4019D4 401DE5 401E4D
4023B3 4023DB 67DB0F 6CAC47 67F074 6CB0F3
6CB33A 6828D7 683CA8 683CCF 6C006D 6C006D
6C006D 6CB20F 406E18 4023B3 4023DB 407629
690344 4033BC 690318 690364 690C03 4E37CA
445171 423680 444B38 444B77 444C46 444C62
444CA9 4357BA 44AA58 402E36 443CF1 445F11
435541 4452C5 445C42 445C65 423680 445171
640558 6C006D 62EF28 62F427 402E36 443CF1
445F11 42535C 4452C5 445C42 445C65 423680

Press Ctrl+C to copy this report!
Continue execution?
---------------------------
Да Нет
---------------------------
Praemonitus praemunitus
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC tries to call ContentGetSupportedField in this crash.
Author of Total Commander
https://www.ghisler.com
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

ghisler(Author) wrote:TC tries to call ContentGetSupportedField in this crash.
Thank you, now I have exact place to dig the problem.
Praemonitus praemunitus
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

Okay, I've found my problem.
I'm using a record:

Code: Select all

 TCustomField = record
  Name: PAnsiChar;
  Units: PAnsiChar;
  FieldType: Integer;
 end;
and some definitions like

Code: Select all

 CustomFieldsCount = 3;
 CustomFields: array [0..CustomFieldsCount-1] of TCustomField = (
 (Name: 'downloadedsize'; Units: 'bytes|kbytes'; FieldType: ft_numeric_64),
 (Name: 'speed'; Units: 'bytes/sec|kbytes/sec'; FieldType: ft_numeric_64),
 (Name: 'saveto'; Units: nil; FieldType: ft_string)
 );
After that in FsContentGetSupportedField this code produces a crash when TCustomField.Units is nil:

Code: Select all

 if FieldIndex in [0..CustomFieldsCount-1] then
  begin
   StrCopy(FieldName, CustomFields[FieldIndex].Name);
   StrCopy(Units, CustomFields[FieldIndex].Units);
   Result:=CustomFields[FieldIndex].FieldType;
  end
 else
   Result:=ft_nomorefields;
and soluton is

Code: Select all

 if FieldIndex in [0..CustomFieldsCount-1] then
  begin
   StrCopy(FieldName, CustomFields[FieldIndex].Name);
   if CustomFields[FieldIndex].Units=nil then
     Units:=nil
   else
     StrCopy(Units, CustomFields[FieldIndex].Units);
   Result:=CustomFields[FieldIndex].FieldType;
  end
 else
   Result:=ft_nomorefields;
Thank you for your guidance.
Last edited by Korney San on 2011-10-28, 14:25 UTC, edited 1 time in total.
Praemonitus praemunitus
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Nice to hear that you found it!
Author of Total Commander
https://www.ghisler.com
Post Reply