diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index aede98a30f..67528d9789 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -1044,7 +1044,8 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) textCtrl << wxT("var1[") << (int) i << wxT("] (type ") << var1[i].GetType() << wxT(") = ") << var1[i].MakeString() << wxT("\n"); } - var1 = wxVariant(new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT))); + wxFont* sysFont = new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT)); + var1 = wxVariant(sysFont); textCtrl << wxT("var1 = (wxfont)\""); wxFont* font = wxGetVariantCast(var1,wxFont); if (font) @@ -1055,6 +1056,8 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) { textCtrl << wxT("(null)\"\n"); } + + delete sysFont; } wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)