Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2000-05

Some patches against access violation errors

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Weustink
to Vincent Snijders: From: Marc Weustink You are right there. This is a design issue, but I could imagine that…

+ From: Vincent Snijders

[ Mouse in Controls.pp ]

+ You are right there. This is a design issue, but I could
+ imagine that the mouse object is not a global object,
+ but a property of the application (or screen) object.

Indeed, it seems to be more logic that the mouse is a property of the screen instead of juast a global.
Both screen and application are defined in forms. In Delphi you use forms only for "screen" applications. If you write a service or a webserver you use other units (and have another application defined). For a service I can (it's difficult but I can) imagine that you want access to the mouse.

Marc

Reply by email

Marc Weustink
to Marc Weustink: Ah, good point. I changed it and committed a fix, however I removed the Create and free…
Florian Klaempfl wrote 8 lines
Marc Weustink schrieb: > I didnt patch them since they depend on the patch for gtkfilesel.pp and > gtksignal.pp. And I think these changes have to bew made by the FPC team. > So I'll wait for them. I think you know enough about GTK to apply patches to the GTK interface units :)

Maybe I know enouhg but, I didn't know if it was possible. Besides that I don't change code of another project whithout notice.

BTW. peter already applied the patches so I committer the ones to gtkobjectr.inc as well

Marc

Reply by email

Vincent Snijders

Hi,

I have been taking a look at the access violation errors when the program terminates. I think they are caused by the fact the the global variable Mouse is freeed twice, once in the Tapplication.terminate and once in the finalization of the controls unit.
I suggest removing the ones in the finalization part.

Also I removed some {$ifdefs linux} from the gtkobject unit which only seemed to be there because the win32-dll's didn't support them at the time, they do now. Pacthes are in the file patches.diff.txt.

So included the patches for gtk packages in the file gtkpatches.diff.txt.

Both patch files are created with cvs diff commands.

I hope this format is readable for you. Please, look at them and apply them.

Regards,
Vincent Snijders.

Index: lcl/controls.pp
=================================================================== RCS file: /FPC/CVS/fpc/lazarus/lcl/controls.pp,v
retrieving revision 1.87
diff -r1.87 controls.pp
1094d1093
< Mouse := TMouse.create;
1097,1098d1095
< Finalization
< Mouse.Free;
Index: lcl/include/form.inc
=================================================================== RCS file: /FPC/CVS/fpc/lazarus/lcl/include/form.inc,v retrieving revision 1.1
diff -r1.1 form.inc
6c6
< Assert(False, 'Trace:Destroying signals for TForm'); ---

Assert(False, 'Trace:Destroying signals for TForm');

Index: lcl/interfaces/gtk/gtkobject.inc
=================================================================== RCS file: /FPC/CVS/fpc/lazarus/lcl/interfaces/gtk/gtkobject.inc,v retrieving revision 1.9
diff -r1.9 gtkobject.inc
408,411c408,409
< {$ifdef LINUX}
< gtk_file_selection_complete(PGtkFileSelection((Sender as TCustomDialog).Handle), pstr); < {$endif}
< StrDispose(pStr);
---

gtk_file_selection_complete(PGtkFileSelection((Sender as TCustomDialog).Handle), pstr); StrDispose(pStr);

1559,1561c1557,1558
< {$ifdef LINUX}
< gtk_signal_handlers_destroy(gObject);
< {$endif}
---

gtk_signal_handlers_destroy(gObject);

Index: gtk/gtk/gtkfilesel.pp
=================================================================== RCS file: /FPC/CVS/fpc/packages/gtk/gtk/gtkfilesel.pp,v retrieving revision 1.1
diff -r1.1 gtkfilesel.pp
54d53
< {$ifndef gtkwin}
56d54
< {$endif}
Index: gtk/gtk/gtksignal.pp
=================================================================== RCS file: /FPC/CVS/fpc/packages/gtk/gtk/gtksignal.pp,v retrieving revision 1.1
diff -r1.1 gtksignal.pp
73d72
< {$ifndef gtkwin}
76d74
< {$endif}

Reply by email

Florian Klaempfl
to Marc Weustink: Ah, good point. I changed it and committed a fix, however I removed the Create and free…
Show quoted text 7 lines
>Also I removed some {$ifdefs linux} from the gtkobject unit which only >seemed to be there because the win32-dll's didn't support them at the time, >they do now. Pacthes are in the file patches.diff.txt. I didnt patch them since they depend on the patch for gtkfilesel.pp and gtksignal.pp. And I think these changes have to bew made by the FPC team. So I'll wait for them.

I think you know enough about GTK to apply patches to the GTK interface units :)

Reply by email

Vincent Snijders
to Marc Weustink: Ah, good point. I changed it and committed a fix, however I removed the Create and free…

From: Marc Weustink

Show quoted text 14 lines
>Hi, > >I have been taking a look at the access violation errors when the program >terminates. I think they are caused by the fact the the global variable >Mouse is freeed twice, once in the Tapplication.terminate and once in the >finalization of the controls unit. >I suggest removing the ones in the finalization part. Ah, good point. I changed it and committed a fix, however I removed the Create and free from TApplication and kept the ones in Controls.pp. Mouse is part of the controls unit and not of the forms unit where Tapplication is defined. (To me it is a bit strange that an object in one unit is responsible for the creation/destruction of an object defined in another unit, what if you don't use forms ?)

You are right there. This is a design issue, but I could imagine that the mouse object is not a global object, but a property of the application (or screen) object.

>Also I removed some {$ifdefs linux} from the gtkobject unit which only >seemed to be there because the win32-dll's didn't support them at the

time,

>they do now. Pacthes are in the file patches.diff.txt. I didnt patch them since they depend on the patch for gtkfilesel.pp and gtksignal.pp. And I think these changes have to bew made by the FPC team.

I sent a message to Peter Vreman, asking him to apply these patches.

Reply by email

Marc Weustink
to Vincent Snijders: I have been taking a look at the access violation errors when the program terminates. I…
Vincent Snijders wrote 7 lines
Hi, I have been taking a look at the access violation errors when the program terminates. I think they are caused by the fact the the global variable Mouse is freeed twice, once in the Tapplication.terminate and once in the finalization of the controls unit. I suggest removing the ones in the finalization part.

Ah, good point. I changed it and committed a fix, however I removed the Create and free from TApplication and kept the ones in Controls.pp. Mouse is part of the controls unit and not of the forms unit where Tapplication is defined. (To me it is a bit strange that an object in one unit is responsible for the creation/destruction of an object defined in another unit, what if you don't use forms ?)

Also I removed some {$ifdefs linux} from the gtkobject unit which only seemed to be there because the win32-dll's didn't support them at the time, they do now. Pacthes are in the file patches.diff.txt.

I didnt patch them since they depend on the patch for gtkfilesel.pp and gtksignal.pp. And I think these changes have to bew made by the FPC team. So I'll wait for them.

Show quoted text 5 lines
So included the patches for gtk packages in the file gtkpatches.diff.txt. Both patch files are created with cvs diff commands. I hope this format is readable for you. Please, look at them and apply them.

They are readable ;-)

Marc

Reply by email