use wxWindowIDRef to transparently implement auto-generated ids ref-counting (slightly modified patch 1835458)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-01-06 14:38:44 +00:00
parent 7d287e713f
commit cf2810aa39
34 changed files with 748 additions and 189 deletions

View File

@@ -1575,7 +1575,10 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
struct XRCID_record
{
int id;
/* Hold the id so that once an id is allocated for a name, it
does not get created again by NewControlId at least
until we are done with it */
wxWindowIDRef id;
char *key;
XRCID_record *next;
};
@@ -1648,11 +1651,6 @@ static void CleanXRCID_Record(XRCID_record *rec)
{
CleanXRCID_Record(rec->next);
// if we had generated the value of this id automatically, release it
// now that we don't need it any longer
if ( wxWindow::IsAutoGeneratedId(rec->id) )
wxWindow::ReleaseControlId(rec->id);
free(rec->key);
delete rec;
}