PDA

View Full Version : Control has no parent window for no apparent reason



masonwheeler
25-07-2008, 11:27 PM
I've got a frame on a form, and the frame contains a panel. Perfectly ordinary TFrame, TForm and TPanel components--not custom components or anything--created at design-time, not set up dynamically at runtime. But when I try to close the program, I sometimes (not always) get an endless loop of "Control panel1 has no parent window!" boxes. Even setting "panel1.parent := self" in the frame's destructor doesn't fix it.

Anyone have any idea what's going on, why it doesn't happen consistently, and how to stop it?

Mason

User137
26-07-2008, 08:47 AM
I would guess a "memoryleak" or something other weird happening in your code, could be anywhere.

Did you try panel1.parent := frame in form's onDestroy event? Still, even if it works like that it doesn't change the fact there is a serious error in your code that could alter something else later or make program crash on runtime.

Memphis
29-08-2008, 05:36 PM
I've got a frame on a form, and the frame contains a panel. Perfectly ordinary TFrame, TForm and TPanel components--not custom components or anything--created at design-time, not set up dynamically at runtime. But when I try to close the program, I sometimes (not always) get an endless loop of "Control panel1 has no parent window!" boxes. Even setting "panel1.parent := self" in the frame's destructor doesn't fix it.

Anyone have any idea what's going on, why it doesn't happen consistently, and how to stop it?

Mason

can you paste your code for freeing the objects?