[lazarus] Weird pairsplitter + notebook + custom component bug
Tony Maro
tony at maro.net
Sun Nov 9 17:51:32 EST 2003
I've posted a sample project at:
http://tony.maro.net/files/test.tgz (95k - sources only)
Here's a pretty detailed description to help you understand what I've
seen. What I THINK is happening is that a component dropped into one
side of a TPairSplitter is not getting it's parent or owner set properly.
The test project also includes the new cbtpack v 2.0 package I'm working
on. It must be installed before you can run the test project. If you
have cbtpack v 1.0 installed, please remove it first.
I've got a component that displays the scheduled transactions. The
component itself isn't the problem (at least not that I can see.)
How to crash it in the IDE:
If you drop the component on the form it works fine. If you drop the
component into one side of a TPairSplitter, it works fine.
If you however drop a TNotebook on the form, put a TPairSplitter on the
second or so page, and then drop the component into one half of the
TPairSplitter... AND set the mode property to cmForecast (not the
default) the form won't open anymore. (Yes, I know it's complex.)
If you don't change the mode property, it works fine. It only fails
when the mode property is changed, and again ONLY if it's on a splitter,
inside a page of a notebook. Imagine that. But it happens EVERY time
those conditions are met.
I placed some writeln's into the TCheckBookSchedule to see what's
happening, and the create method completes just fine. But then, for
some reason a Paint message is sent to the control. The paint message
is never sent if the MODE property isn't changed from default.
Here's the dump from Lazarus when you try to open this project:
TPascalParserTool.BuildTree B OnlyIntf=TRUE
/home/tony/Projects/test/unit1.pas
TMainIDE.DoLoadLFM AncestorClassName=TForm AncestorType=TFORM
Creating checkbookschedule
Created checkbookschedule
Painting checkbookschedule Checkbookschedule1
Done painting checkbookschedule Checkbookschedule1
[TJITComponentList.AddJITChildComponentFromStream] ERROR reading form
stream of Class 'TForm1' Error: Access violation
You'll notice the paint sent immediately, despite the fact this tab of
the notebook isn't visible... No further tabs will load. There's a
no-named stub of a tab visible on the notebook. If you click it, a
separate window will open that shows the contents of the failing tab.
If you close this window, Lazarus will completely vanish, without even a
note in the console.
Also, I get the following when it opens the project, probably related to
the paint message when isn't visible:
Gtk-CRITICAL **: file gtkstyle.c: line 515 (gtk_style_attach): assertion
`window != NULL' failed.
Gdk-CRITICAL **: file gdkwindow.c: line 1789 (gdk_window_get_events):
assertion `window != NULL' failed.
Gdk-CRITICAL **: file gdkwindow.c: line 1816 (gdk_window_set_events):
assertion `window != NULL' failed.
Gtk-CRITICAL **: file gtkstyle.c: line 515 (gtk_style_attach): assertion
`window != NULL' failed.
Gdk-CRITICAL **: file gdkwindow.c: line 728 (gdk_window_ref): assertion
`window != NULL' failed.
Gtk-CRITICAL **: file gtkstyle.c: line 515 (gtk_style_attach): assertion
`window != NULL' failed.
Gdk-CRITICAL **: file gdkwindow.c: line 728 (gdk_window_ref): assertion
`window != NULL' failed.
Gdk-CRITICAL **: file gdkwindow.c: line 738 (gdk_window_unref):
assertion `window != NULL' failed.
If you edit the unit1.lfm file to remove the "MODE = cmforecast" line,
then recreate the associated resource, it will open fine.
Results if you design it and then immediately build it:
If you make and build the project from scratch without closing the
project, it will build just fine, but the TCheckBookSchedule never gets
displayed. It never gets a paint message. I don't know where it's gone
if anywhere... but it DOES get created.
The TCheckbook is descended from the same component as the
TCheckBookSchedule, and doesn't have these problems.
--
Tony Maro
Systems Consultant
The Maro Group
(256) 337-5759
http://www.maro.net/
More information about the Lazarus
mailing list