[WFX] Using certain components/features crashes TC x64

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

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

[WFX] Using certain components/features crashes TC x64

Post by *Dalai »

Hey *.*

Some time ago, in an early development state of Services2, I tried to use tooltips/hints/quicktips (whatever you call it, you know what I mean ;)) on some controls, but as soon as they should have been displayed (hovering the mouse over the control) TC x64 crashed. It crashed so hard, even the OS (Dr Watson) didn't catch it. So I passed on them.

A couple of weeks ago, I implemented a new feature into my plugin and used the TActionList class. And it happended the same thing: TC x64 crashed.

Using the same features in another dialog of the same plugin showed me a TC error report:

Code: Select all

---------------------------
Total Commander 8.51a
---------------------------
Access violation.
Access violation
Windows XP Pro x64 SP2 5.2 (Build 3790)

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

Stack trace (x64):4AC25F
4364F2 436372 436191 40F40D 8CDC28 814EB9 8D7E72 77C43ABC

Press Ctrl+C to copy this report!
Continue execution?
---------------------------
Ja   Nein   
---------------------------
It's always the same stack trace, no matter if I use TActionList or tooltips. So I guess, there's something not initialized properly or something like that. Unfortunately, I'm unable to run TC x64 in a debugger, because this crappy thing always closes TC as soon as the plugin loads with a "Disconnected session" error :roll:.

Now I'm wondering: Has anyone successfully used TActionList and/or (Delphi) tooltips in a TC plugin? Just to be clear: There is no problem in TC 32 bit, only TC 64 bit crashes (or shows the error report).

For now, I have worked around the need for TActionList and tooltips, but times may change...

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50421
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's very odd that you cannot debug with TC as the host - I do it all the time. Try opening TC with a directory which do not contain executables, they were causing troubles here due to the UAC icon checks. Also make sure you don't run TC with higher user rights.
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

ghisler(Author) wrote:It's very odd that you cannot debug with TC as the host - I do it all the time.
Unfortunately, it's a common issue. Just google for "delphi disconnected session" and you will find loads of hits (however, a good portion of them talk about Win8 which is unimportant in my case). TC runs in the debugger, yes, but as soon as TC tries to load my plugin, the debugger closes TC and switches back to the IDE and shows the mentioned error.

It doesn't matter if I launch TC using the Delphi IDE or if I connect to the already running process. It doesn't even matter if I enter the plugin or want to view its properties (the service list isn't retrieved in latter case).

I didn't find any solution to that error so far. I only know that this is not a specific error but a generic one (and an incredibly helpful one too ... :roll:).
Try opening TC with a directory which do not contain executables, they were causing troubles here due to the UAC icon checks.
There is no UAC on XP x64.
Also make sure you don't run TC with higher user rights.
I'm working as admin on this specific VM system I'm developing in.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

I was able to dig a little bit deeper. I compiled my project with Delphi XE5 (Update 2) and there I'm able to run TC x64 in the debugger, including the plugin, of course. So the "disconnected session" is an issue in XE2 (even with Update 4 installed).

Unfortunately, the result stays the same: exception because of an access violation. However, the debugger doesn't step into any code, when the execution is halted after the exception is caught - like it normally does. Even the stack trace which TC shows is exactly the same.

So, I don't know what to do and where to look... It's all just weird. It wouldn't surprise me if the error is somewhere in the Delphi VCL or RTL ...

Just for the record: This is the way I create my Forms:

Code: Select all

procedure PluginShowForm(const AhParent: HWND);
var
    fmPluginSettings: TfmPluginSettings;
begin
//    Application.Initialize;
    Application.Handle:= AhParent;
    fmPluginSettings:= TfmPluginSettings.Create(nil);
    try
        fmPluginSettings.Init;
        fmPluginSettings.ShowModal;
    finally
        fmPluginSettings.Free;
    end;
end;
The Application.Initialize was just a test to see if it changes anything (it doesn't). The tooltips are enabled via the TControl.Hint and TControl.ShowHint properties (whether at runtime or design time).

For now, I can work without tooltips and TActionList. Well, I rather have to, since I don't want to release my plugin with known crashes ;).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50421
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Did you try set a breakpoint at the beginning of each plugin function, so you can single step through them? When an exxception occurs, it's often too late to go back into the debugger.
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

No, but I just found the trigger for this exception: It's the line

Code: Select all

Application.Handle:= AhParent;
Removing this doesn't cause an exception anymore. At last ... :)

However, I have a new problem: I can
  • either use TForm.Create which creates a new button on the Windows taskbar - not nice (that's the reason why I used Application.Handle in the first place)
  • or use TForm.CreateParented(AhParent) which causes that the TC window (showing a dialog of my plugin) can't be activated by a click on the taskbar button if some other application is in the foreground - not nice either.
How do you create your (modal) dialogs in plugins?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply