[FIX] Memory leak in ScintillaEditView
Reported by Thell Fowler | February 4th, 2010 @ 03:39 PM | in v2.0.0
There is a memory leak in ScintillaEditView when a hotspot style is present within an activated tab. It needs fixing.
Comments and changes to this ticket
-
Thell Fowler February 4th, 2010 @ 03:41 PM
- State changed from new to open
-
Thell Fowler February 4th, 2010 @ 04:07 PM
(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]
Signed-off-by: Thell Fowler git@tbfowler.name
http://github.com/almostautomated/npp-community/commit/b020bea0056a... -
Thell Fowler February 4th, 2010 @ 04:08 PM
- State changed from open to needs_ack
- Assigned user changed from Thell Fowler to npp-community
-
Jocelyn Legault February 5th, 2010 @ 04:29 AM
- 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 February 8th, 2010 @ 03:33 PM
(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]
Signed-off-by: Thell Fowler git@tbfowler.name
http://github.com/almostautomated/npp-community/commit/75c84486894c... -
Thell Fowler February 8th, 2010 @ 03:56 PM
- State changed from open to needs_ack
-
Jocelyn Legault February 9th, 2010 @ 04:41 AM
- State changed from needs_ack to acked
-
Thell Fowler February 14th, 2010 @ 06:10 PM
- State changed from acked to proposed
-
Thell Fowler February 26th, 2010 @ 05:12 PM
- 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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Notepad++ Community Release