[FIX] Memory leak in ScintillaEditView
-
Thell Fowler
- State changed from new to open
-
Thell Fowler
(from [b020bea0056a697a9bc131227d3321838551613e]) ScintillaEditView.cpp: fix createHotSpotFromStyle mem leak
- When a document view is activated that has a hotspot style enabled a memory leak for the generic_name was caused because of the new TCHAR pointer. This change deletes it after setting the fontname for the outHotSpot.
- Also corrects the nativeLangEncodingCopy value which was a constant -1 instead of keeping a static value of the nativeLangEncoding.
[#37 [FIX] Memory leak in ScintillaEditView]
Signed-off-by: Thell Fowler git@tbfowler.name
http://github.com/almostautomated/npp-community/commit/b020bea0056a... -
Thell Fowler
- State changed from open to needs_ack
- Assigned user changed from Thell Fowler to npp-community
-
Jocelyn Legault
- State changed from needs_ack to open
While the fix in itself works, I think we could skip the whole dynamic assignation altogether.
I'd go with either:
TCHAR *generic_fontname[128]; #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const wchar_t * fontNameW = wmc->char2wchar(fontNameA, nativeLangEncodingCopy); lstrcpy(generic_fontname, fontNameW); #else lstrcpy(generic_fontname, fontNameA); #endif out_hotspot._fontName = generic_fontname;or even better (since we don't really care for UNICODE):
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); out_hotspot._fontName = wmc->char2wchar(fontNameA, nativeLangEncodingCopy);The dynamic assignation as we can see is completely useless in this case.
-
Thell Fowler
(from [75c84486894cb5be4746f65ededcc54f7344df8d]) ScintillaEditView.cpp: fix createHotSpotFromStyle mem leak
- When a document view is activated that has a hotspot style enabled a memory leak for the generic_name was caused because of the new TCHAR pointer. This change deletes it after setting the fontname for the outHotSpot.
- Also corrects the nativeLangEncodingCopy value which was a constant -1 instead of keeping a static value of the nativeLangEncoding.
[#37 [FIX] Memory leak in ScintillaEditView]
Signed-off-by: Thell Fowler git@tbfowler.name
http://github.com/almostautomated/npp-community/commit/75c84486894c... -
Thell Fowler
- State changed from open to needs_ack
-
Jocelyn Legault
- State changed from needs_ack to acked
-
Thell Fowler
- State changed from acked to proposed
-
Thell Fowler
- Assigned user cleared.
- State changed from proposed to resolved
Promoted to master
Changeset [db1b02912b75bd13d66db16adec84d12bdc8c3ac] by Thell Fowler
February 26th, 2010 @ 03:18 PM
Merge branch 'tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak'
- tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak: ScintillaEditView.cpp: fix createHotSpotFromStyle mem leak http://github.com/npp-community/npp-community/commit/db1b02912b75bd
Committed by Thell Fowler
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.