Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

[FIX] Memory leak in ScintillaEditView

#37

There is a memory leak in ScintillaEditView when a hotspot style is present within an activated tab. It needs fixing.

Reported by Thell Fowler · February 4th, 2010 @ 03:39 PM

State: resolved
Milestone: v2.0.0
Assigned to: nobody

Activity

  1. Thell Fowler
    Thell Fowler
    • State changed from new to open

    February 4th, 2010 @ 03:41 PM

  2. Thell Fowler
    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...

    February 4th, 2010 @ 04:07 PM

  3. Thell Fowler
    Thell Fowler
    • State changed from open to needs_ack
    • Assigned user changed from Thell Fowler to npp-community

    February 4th, 2010 @ 04:08 PM

  4. Jocelyn Legault
    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.

    February 5th, 2010 @ 04:29 AM

  5. Thell Fowler
    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...

    February 8th, 2010 @ 03:33 PM

  6. Thell Fowler
    Thell Fowler
    • State changed from open to needs_ack

    February 8th, 2010 @ 03:56 PM

  7. Jocelyn Legault
    Jocelyn Legault
    • State changed from needs_ack to acked

    February 9th, 2010 @ 04:41 AM

  8. Thell Fowler
    Thell Fowler
    • State changed from acked to proposed

    February 14th, 2010 @ 06:10 PM

  9. Thell Fowler
    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'

    Committed by Thell Fowler

    February 26th, 2010 @ 05:12 PM

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.