wxXmlInitResourceModule() issues (Issue #26039)

8 views
Skip to first unread message

Dan

unread,
Dec 18, 2025, 6:41:19 PM (2 days ago) Dec 18
to wx-...@googlegroups.com, Subscribed
CEXT-Dan created an issue (wxWidgets/wxWidgets#26039)

My project wraps Python and wxPython for AutoCAD.
I use wxPython’s DLLs, so I guess that's version 3.2 ish

initWxApp and initWxApp functions are called when my DLL is loaded/unloaded in AutoCAD
https://github.com/CEXT-Dan/PyRx/blob/7c17f633defc7fa339abf064592fa85044e91310/PyRxCore/PyRxApp.cpp#L155-L199

if I add this to initWxApp

wxXmlInitResourceModule()
wxXmlResource::Get()->InitAllHandlers();

then something is trying to call wxApp::MSWProcessPendingEventsIfNeeded after wxEntryCleanup() is called, wxTheApp is null, my .DLL is already unloaded I get an exception in the host application

Exception thrown at 0x00007FFB6AB4AC31 (wxmsw32u_core_vc140_x64.dll) in gcad.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

Note, in the real world I don’t explicitly call wxXmlInitResourceModule, this is what’s called in wxPython. But I can reproduce the issue excluding python. If it's not loaded, there's no issue

My workaround is not satisfactory, it there something leaking in wxXmlResource?

wxPython does not have .pdb files, so I can’t debug.

Any ideas?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26039@github.com>

VZ

unread,
Dec 18, 2025, 6:44:42 PM (2 days ago) Dec 18
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26039)

wxXmlInitResourceModule() shouldn't be called, it's some remnant of 25 year old code which probably shouldn't even exist.

I don't know why wxPython uses it, but the only fix at wx side is probably to make this function do nothing. It would be even better to remove it completely, of course, but if wxPython uses it, it would break its build.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26039/3672759514@github.com>

Dan

unread,
Dec 18, 2025, 6:58:29 PM (2 days ago) Dec 18
to wx-...@googlegroups.com, Subscribed
CEXT-Dan left a comment (wxWidgets/wxWidgets#26039)

wxXmlInitResourceModule() shouldn't be called, it's some remnant of 25 year old code which probably shouldn't even exist.

I don't know why wxPython uses it, but the only fix at wx side is probably to make this function do nothing. It would be even better to remove it completely, of course, but if wxPython uses it, it would break its build.

It seems wxPython calls it in

from wx import xrc
https://github.com/wxWidgets/Phoenix/blob/09516ed4f0b36236547683d4bc1cf4387562657e/etg/_xrc.py#L63-L66

It seems something somewhere is calling wxTheApp without a null check

IMHO, it should be removed for 3.3 (3.4) to force this fix. As far as I can tell wxPython has not switched to 3.3 yet


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26039/3672786288@github.com>

VZ

unread,
Dec 18, 2025, 7:04:17 PM (2 days ago) Dec 18
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26039)

The call to this function was uncommented in wxWidgets/Phoenix@d9a64ce by Robin, so apparently it was supposed to help with module reinitialization, but I don't see how.

I'm in favour of deprecating this function and making it do nothing in 3.3.2.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26039/3672800507@github.com>

Reply all
Reply to author
Forward
0 new messages