Crash in event proc after IProcesses.RefreshList call

delphi package - easy access to kernel objects etc.
Post Reply
Bart Verkoeijen
Posts: 5
Joined: Mon Jan 23, 2006 11:22 am
Location: The Netherlands

Crash in event proc after IProcesses.RefreshList call

Post by Bart Verkoeijen »

Hi, I'm working on a Delphi 5 application that monitors the current running processes. To detect changes I'm using the IProcesses interface with RefreshList and an event registered to the IProcesses interface with ICustomBasicList.RegisterChangeEvent.

The event works well. When I start or stop a process the event gets fired and my event procedure does his job. However, in one particular situation the app crashes and shows a Access Violation. I've located the origin of the violation, but it does not make sense to me. The problem lies within a cast in the procedure.

When I stop a process, the code below works just fine. However, when I start a process the app crashes after finishing the procedure. The code is very minimalistic, so I think the problem lies within madKernel.

Code: Select all

procedure TListFileHandlesF.ProcessListChange(const list: ICustomBasicList;
  const item: IBasic; beforeChange: boolean; changeType: TChangeType;
  oldIndex, index: integer);
var
    Proc: IProcess;
begin
    Proc := item as IProcess;
end;
The cast doesn't fail when I start a application (for instance, I can get the exe with Proc.ExeFile), but the procedure only fails then I put this typecast in the body.

What am I doing wrong? Or is this a bug in madKernel?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Can you create a little demo project for me with which I can reproduce the problem on my PC?
Bart Verkoeijen
Posts: 5
Joined: Mon Jan 23, 2006 11:22 am
Location: The Netherlands

Post by Bart Verkoeijen »

You've got mail. ;)

Start and stop processes while running my demo. Hit the Refresh button to see the effect.
If you start a process and click on the Refresh button, you should get an access violation like I do.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Hmmmm... I didn't receive the mail yet. Maybe my spam/virus filter deleted it? Can you upload the file somehow? Thanks!
Bart Verkoeijen
Posts: 5
Joined: Mon Jan 23, 2006 11:22 am
Location: The Netherlands

Post by Bart Verkoeijen »

I'm not at work right now, I'll upload it tomorrow to a public place, and send you the URL via PM. ;)
Bart Verkoeijen
Posts: 5
Joined: Mon Jan 23, 2006 11:22 am
Location: The Netherlands

Post by Bart Verkoeijen »

Hmm, PM does not work on this forum. Well, I've sent a new e-mail. My mailclient did not do its job properly. ;) Please let me know when you receive the e-mail. :)
Bart Verkoeijen
Posts: 5
Joined: Mon Jan 23, 2006 11:22 am
Location: The Netherlands

Post by Bart Verkoeijen »

For people who want to know: Mathias has found the bug and will include the fix in the upcomming version. ;)
Post Reply