Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxSmith - tutorial

<< < (9/10) > >>

Grom:

--- Quote from: MortenMacFly on October 04, 2008, 03:50:50 pm ---
--- Quote from: Master on October 04, 2008, 10:28:15 am ---hello, i got some questions!:

--- End quote ---
Sorry to interrupt here, but these question go far beyond the scope of our forums. Thus in fact they violate our forum rules. I suggest you ask in a programming and/or wx related forum.

--- End quote ---

Edit: [REMOVED NON ENGLISH CONTENT] :lol: :lol: :lol:

Fex:
I'm working my way through the wxsmith tutorials. They are really good  :)

I have not worked with wxwidgets before but I do have a fair bit of programming experiance. I have a question about tutorial 4

http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Working_with_multiple_resources

The code says

--- Code: ---void Tutorial_4Frame::OnButton3Click(wxCommandEvent& event)
{
    FirstFrame* frm = new FirstFrame(this);
    frm->Show();
}

--- End code ---

Shouldn't there be a


--- Code: ---delete frm;
--- End code ---

in there somewhere to ensure no memory leaks? Or does it automatically handle them somehow?

Fex.

Pecan:
I learned the hard way, that if you delete a control/frame/window that is owned by wxWidgets, wxWidets will have a stroke and die.

When a wxWidgets owned frame is destroyed by wxWidgets, all its children will be destoyed automatically.

The objects you need to delete are the ones you created outside the wxWidgets knowledge, such as "myvartype* myvar = new (myOwnArray)" etc. wxWidgets doesn't know about these.

There was a good post about this by Thomas on the forum some time back(Here), but the links became obsolete. I think they were these:

http://docs.wxwidgets.org/2.8.6/wx_windowdeletionoverview.html
http://wiki.wxwidgets.org/Avoiding_Memory_Leaks

Key words: wxWidgets ownership responsibility deleting avoiding memory leaks deletion overview

Fex:
Thanks Pecan  :D

ollydbg:

--- Quote from: Pecan on November 02, 2008, 03:05:59 pm ---I learned the hard way, that if you delete a control/frame/window that is owned by wxWidgets, wxWidets will have a stroke and die.

When a wxWidgets owned frame is destroyed by wxWidgets, all its children will be destoyed automatically.

The objects you need to delete are the ones you created outside the wxWidgets knowledge, such as "myvartype* myvar = new (myOwnArray)" etc. wxWidgets doesn't know about these.

There was a good post about this by Thomas on the forum some time back(Here), but the links became obsolete. I think they were these:

http://docs.wxwidgets.org/2.8.6/wx_windowdeletionoverview.html
http://wiki.wxwidgets.org/Avoiding_Memory_Leaks

Key words: wxWidgets ownership responsibility deleting avoiding memory leaks deletion overview

--- End quote ---

This is a good tutorials on wxWidgets creation and destroying! thanks for your explanation.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version