Well spotted. These days such metric gathering should be done lazily and in a way that the metrics can be invalidated and lazily regathered again, such as when theme font sizes change etc.
Windowed controls should at least defer such stuff until createwnd time, but I don't know when plain tcontrol should expect to be able to do it. Its not even afe during the first paint as it might not be painting to the screen dc. Maybe tcontrols auto to have a method called when their parent's handle gets created; this wouldn't solve the lazy metrics problem, but would give controls a clear and clean place do do such metric gathering. Sam -----Original Message----- From: "Mattias Gaertner" <[EMAIL PROTECTED]> To: [email protected] Sent: 11/05/07 18:49 Subject: Re: [lazarus] how to debug the lcl On Fri, 11 May 2007 11:03:16 -0600 "Seth Grover" <[EMAIL PROTECTED]> wrote: > A month ago I reported a LCL bug causing a crash in GTK. > > http://freepascal.org/mantis/view.php?id=8610 > > Since it hadn't been looked at by any of the developers yet, I wanted > to try to see if I could figure out if there was some obvious problem. > > I can tell the bug is in SendSizeNotificationToLCL from the stack > trace, but I don't know how to actually debug down into the lcl code. > The last place the debugger lets me debug down to is the > gtk_notebook_insert_page_menu call in TGtkWSCustomNotebook.AddPage. > > Can anyone with more experience coding the LCL tell me how to actually > be able to debug down into the code I need to look at, or (even > better), take a look at fixing this bug? I tested the example given in the bug report. With gtk2 I get a different error: (project1:28153): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed ERROR in LCL: TGtkWidgetSet.CreateDCForWidget: Unable to realize GdkWindow and a long stack trace. The reason is, that TOvcVirtualListBox is trying to get the Canvas.TextHeight during creation, before the widget is associated with a screen - before the LCL has added the notebook page handle to the notebook handle. Possible solution: a) Improve TNoteBook to create/add the page handle in one step. b) Change TOvcVirtualListBox to init later. Mattias _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
