#106 closed Aufgabe (fixed)
Trend: SelectObject() -> DeleteObject()
| Reported by: | Melanie Hermann | Owned by: | Melanie Hermann |
|---|---|---|---|
| Priority: | kurzfristig | Milestone: | |
| Component: | Gesamtsystem | Version: | |
| Severity: | unkritischer Fehler | Keywords: | |
| Cc: |
Description
Trend:
Zu jedem SelectObject() sollte es ein DeleteObject() geben.
Dies überprüfen und einbauen.
Change History (2)
comment:1 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 13 years ago
http://computer-programming-forum.com/82-mfc/353f0657ceb882bf.htm
"Actually, you don't need the explicit DeleteObject calls if you change
where your declarations are made; because you have declared these as
CPen and CBrush (not CPen * and CBrush *) they will be destructed when
you leave the scope in which they are declared. The consequence of
the destructor on CPen and CBrush is to implicitly DeleteObject. "
Note:
See TracTickets
for help on using tickets.
Im Trend.cpp wird kein DeleteObject() benötigt.
Denn die erstellten CPen und CFont werden hier lokal deklariert und werden nach dem Verlassen der Funktion CTrend::Draw() wieder zerstört.
Hier sollte es also keine Speicherprobleme geben.