Bonjour!

J'écris l'interface graphique d'une petite application et j'ai un problème de memory leaks.
J'ai essayé pas mal de trucs mais je ne vois vraiment pas d'où ça vient.
Quand je ferme la fenêtre principale, le compilateur m'envoie le message suivant :

Detected memory leaks!
Dumping objects ->
{1480} normal block at 0x00DBFF60, 48 bytes long.
Data: <$d w > 24 64 80 00 01 00 00 00 77 00 00 00 8D 00 00 00
{1478} normal block at 0x00DC0E50, 8 bytes long.
Data: <tG} ` > 74 47 7D 00 60 FF DB 00
Object dump complete.

Bon c'est pas grand chose me direz-vous, mais j'aimerais bien produire le code le plus propre possible.

Voilà la déclaration des classes :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Declare the application class
class MyApp : public wxApp
{
	public :
		// Called on application startup
		virtual bool OnInit();
		virtual int OnExit();
	private :
		MyFrame* frame;
		wxJPEGHandler* imageHandler;
};
 
// Declare our main frame class
class MyFrame : public wxFrame
{
	public :
		//Constructor
		MyFrame(const wxString& title);
 
		//Event handlers
		void OnQuit(wxCommandEvent& event);
		void OnButton(wxCommandEvent& event);
		void OnLink(wxCommandEvent& event);
 
	private:
		// This class handles events
		DECLARE_EVENT_TABLE()
 
		//Attributes
		wxArrayString choices;
		wxPanel* panel;
		wxBitmap* bitmap;
		wxStaticBitmap* staticBitmap;
		wxComboBox* comboBox;
		wxButton* link;
		wxButton* button;
		wxBoxSizer* topSizer;
};
et leur implémentation (partielle):

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const int ID_COMBOBOX = 101;
const int BUTTON2 = 102;
const int BUTTON3 = 103;
 
// Implements MyApp& GetApp()
DECLARE_APP(MyApp)
 
// Give wxWidgets the means to create a MyApp object
IMPLEMENT_APP(MyApp)
 
// Initialize the application
bool MyApp::OnInit()
{
	imageHandler = new wxJPEGHandler;
	wxImage::AddHandler(imageHandler);
 
	// Create the main application window
	frame = new MyFrame(wxT("Test"));
 
	// Show it
	frame->Show(true);
 
	// Start the event loop
	return true;
}
 
int MyApp::OnExit()
{
	return 0;
}
 
// Event table for MyFrame
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
	EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
	EVT_BUTTON(BUTTON2, MyFrame::OnButton)
	EVT_BUTTON(BUTTON3, MyFrame::OnLink)
END_EVENT_TABLE()
 
void MyFrame::OnQuit(wxCommandEvent& event)
{
	// Destroy the frame
	Close(true);
}
 
MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize)
{
	choices.Add(wxT("Aymeric"));
	choices.Add(wxT("Bruno"));
 
	panel = new wxPanel(this);
 
	panel->SetBackgroundColour(*wxWHITE);
 
	topSizer = new wxBoxSizer(wxVERTICAL);
 
	wxImage image(wxT("C:\\Documents and Settings\\Clément\\Bureau\\images.jpg"), wxBITMAP_TYPE_JPEG);
	bitmap = new wxBitmap(image);
 
	staticBitmap = new wxStaticBitmap(panel, wxID_STATIC, *bitmap, wxDefaultPosition, wxDefaultSize);
	topSizer->Add(staticBitmap, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
 
	comboBox = new wxComboBox(panel, ID_COMBOBOX, wxT("Aymeric"), wxDefaultPosition, wxDefaultSize, choices, wxCB_DROPDOWN);
	topSizer->Add(comboBox, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
 
	link = new wxButton(panel, BUTTON3, "Creation d'un nouveau profil");
	link->SetForegroundColour(*wxBLUE);
	link->SetWindowStyle(wxBORDER_NONE);
	topSizer->Add(link, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
 
	button = new wxButton(panel, BUTTON2, _T("Ok"), wxDefaultPosition, wxSize(50,30), wxID_JUSTIFY_CENTER);
	topSizer->Add(button, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
 
	topSizer->SetSizeHints(this);
	SetSizer(topSizer);
}
Quelqu'un aurait une idée?

Merci d'avance!