Opened 3 months ago

Last modified 3 months ago

#18495 confirmed defect

wxMBConv pure vitrual call on exit with memory leaks

Reported by: scott_ish_scott Owned by:
Priority: low Milestone:
Component: base Version: 3.1.2
Keywords: Cc: scott.ish.scott99@…
Blocked By: #18497 Blocking:
Patch: no

Description (last modified by vadz)

Hello,

I'm getting an exception at exit due to a pure virtual call to Clone() on wxMBConv. This happens when there has been a memory leak of a wx object. This is due to memory.cpp calling DoDump which eventually calls wxMessageOutputWithConv with a wxMBConv.

I think in previous versions this would print text to the output window showing memory leak info.

This can be easily created in minimal if a menu object is added but never used or deleted (to force a memdump from leak). Add the following to minimal.cpp around line 160:

wxMenu* m_menuFile = new wxMenu;

Running windows, 3.1.2.

Stack:

minimal.exe!wxMessageOutputWithConv::wxMessageOutputWithConv(const wxMBConv & conv) Line 69	C++
 	minimal.exe!wxMessageOutputStderr::wxMessageOutputStderr(_iobuf * fp, const wxMBConv & conv) Line 172	C++
 	minimal.exe!wxMessageOutputDebug::wxMessageOutputDebug() Line 154	C++
 	minimal.exe!wxDebugContext::OutputDumpLine(const wchar_t * szFormat, ...) Line 845	C++
 	minimal.exe!wxDebugContextDumpDelayCounter::DoDump() Line 1134	C++
 	minimal.exe!wxDebugContextDumpDelayCounter::~wxDebugContextDumpDelayCounter() Line 1128	C++
 	[External Code]	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msvcr120d.dll]	Unknown

Change History (3)

comment:1 follow-up: Changed 3 months ago by vadz

  • Description modified (diff)
  • Priority changed from normal to low

I strongly recommend avoiding turning on wxUSE_MEMORY_TRACING and similar settings. They are old, broken in too many different ways to count and unlikely to be fixed. And you don't need them, especially not when using MSVC as its CRT does a much better job than wx code anyhow.

comment:2 in reply to: ↑ 1 Changed 3 months ago by scott_ish_scott

  • Cc scott.ish.scott99@… added

Replying to vadz:

I strongly recommend avoiding turning on wxUSE_MEMORY_TRACING and similar settings. They are old, broken in too many different ways to count and unlikely to be fixed. And you don't need them, especially not when using MSVC as its CRT does a much better job than wx code anyhow.

Ok, thanks. Hadn't realised I'd switched that on. Cheers.

comment:3 Changed 3 months ago by vadz

  • Blocked By 18497 added
  • Status changed from new to confirmed

FWIW the problem is even more basic, see #18497.

I still think the answer to this one is to just remove all this memory debugging code though.

Note: See TracTickets for help on using tickets.