Bug in change plugin attributes

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Bug in change plugin attributes

Post by *tbeu »

There is a bug in the change plugin attributes dialog of the content plugin interface of Total Commander 7.04a. The bug is in the parameters of the ContentSetValue() function when called a second time with more than one attribute.

For demonstration the open source JPG comment, EXIF and IPTC metadata content plugin Vs 2.1.4.0 is used.

The declaration of ContentSetValue() looks like

Code: Select all

int ContentSetValue(char* FileName, int FieldIndex, int UnitIndex, int FieldType, void* FieldValue, int flags);
When the change attributes dialog is called the first time with the settings from Image: http://tbeu.de/forum/ca1.png ContentSetValue() is called three times and every thing is fine.

Code: Select all

ContentSetValue("C:\\file.jpg", 21, 0, 8, 0x00c2dca4, 1)
ContentSetValue("C:\\file.jpg", 23, 0, 8, 0x00c2e71c, 2)
ContentSetValue(NULL, -1, -1, 0, 0x00000000, 0)
When the change attributes dialog is then called a second time with the new settings from Image: http://tbeu.de/forum/ca2.png ContentSetValue() is called four times, however the field index of the second call is zero instead of 23 as before.

Code: Select all

ContentSetValue("C:\\file.jpg", 21, 0, 8, 0x00c28918, 1)
ContentSetValue("C:\\file.jpg", 0 /* bug: value 23 is expected */, 0, 8, 0x00bef978, 0)
ContentSetValue("C:\\file.jpg", 3, 0, 8, 0x00bf07b8, 2)
ContentSetValue(NULL, -1, -1, 0, 0x00000000, 0)
As result the wrong attribute is changed!
Last edited by tbeu on 2009-01-26, 11:03 UTC, edited 2 times in total.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48070
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I will try to reproduce it, thanks. What do you mean with "a second time"? Do you mean that the problem doesn't occur when you use the attributes dialog for the first time after starting TC?
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

ghisler(Author) wrote:What do you mean with "a second time"?
Right, if the change attributes dialog is called the first time after starting TC it works as expected. If the same scenario is then repeated a second time (of the same instance of TC) the plugin parameters are wrong as stated above.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48070
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I can confirm the problem with the referenced plugin. It's indeed a bug: The change attribute dialog currently supports only a maximum of 20 changeable properties per plugin. The plugin can have more properties, but only 20 of them may be changeable. I changed this from 20 to 100 sometimes, but forgot to increase the size of the reference array which maps the changeable property numbers to all available properties. Therefore an overlap can occur when changing more than one property at a time. I will fix it in TC 7.5 (and Tc 7.04c or so).
Author of Total Commander
https://www.ghisler.com
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

OK, then the current workaround is to change only one attribute per time if there are in total more than 20 changeable attributes of the plugin.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Fixed in TC 7.5PB1. Thank you!

However, there might be plugins with more than 100 changeable fields.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48070
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks! That should be no problem, though, because TC will correctly limit them to 100 now.
Author of Total Commander
https://www.ghisler.com
Post Reply