Page 1 of 1

wxPropertyGrid issues with Classic Windows Theme

Posted: Mon Apr 29, 2019 5:40 am
by vouk
First, in my case under Win 10 everything works fine. No issues at all and I really love to work with wxWidgets.

My application is built with wx 3.1.2 / VS 2017 / Win 10 and a plugin to Adobe Premiere running in an DLL by using this technique: https://simon.rozman.si/computers/wxwid ... dll-plugin

But users report some issues with Windows version < 10. When they open the dialog the first time everything works fine. Once they close it and open it again the dialog looks like this and the host application crashes:
vkdr1.png
vkdr1.png (52.94 KiB) Viewed 2975 times
vkdr0.png
vkdr0.png (33.14 KiB) Viewed 2975 times
Unfortunately i can not reproduce these issues and do not have any debug information or even error messages.

The source code is here: https://github.com/Vouk/voukoder/blob/m ... Editor.cpp

Does anybody have an idea what could be the cause of this issue?

Thank you.

Edit: This only happens with the Windows Classic desktop theme.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 8:00 am
by doublemax
I don't have a real idea what the problem could be. Just some things to check:

The screenshot looks like old Windows 2000. Does the DLL not have a manifest or did the user select the "Classic" theme? In the latter case it would be interesting if the problem only occurs with that theme.

Your code uses Windows SDK 8.1. I don't know what happens if this runs under Windows 7. But it's something worth looking at.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 8:05 am
by vouk
Yes, I just edited the original post. It only occurs when the user is using the classic theme.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 8:11 am
by doublemax
Can you switch to Windows SDK 7.1 for a test or do you need functions from the newer SDKs?

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 8:29 am
by vouk
There are some issues with SDK 7.1. I can't install it on Windows 10 because it complains about missing .NET components.

But i am using SDK 8.1 (I downgraded from SDK 10 already) but users still complain about this error on windows 8.1.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 8:55 am
by doublemax
Sorry, i have no other idea how to approach this.

Can you reproduce it yourself now that you know it's related to the classic theme?

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 9:23 am
by vouk
Yes, i will install a debug build later and will check what i can find out with the debugger.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 4:23 pm
by vouk
This is the information that windbg shows:

Code: Select all

(fbc.920): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for C:\Program Files\Adobe\Common\Plug-ins\CS6\MediaCore\VoukoderR2.prm
VoukoderR2!`anonymous namespace'::GestureFuncs::LoadGestureSymbols+0xb7:
000007fe`e4c78067 49ff6220        jmp     qword ptr [r10+20h] ds:00000000`00000020=????????????????
Does that tell you anything?

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Mon Apr 29, 2019 6:02 pm
by doublemax
vouk wrote: Mon Apr 29, 2019 4:23 pmDoes that tell you anything?
Sorry, no.

Have you tried to reproduce it in a stand-alone exe? Debugging the plug-in will be very hard.

Re: wxPropertyGrid issues with Win 7 and Win 8.1

Posted: Tue Apr 30, 2019 5:41 am
by vouk
I installed VS in the VM and the debugger breaks into the exception now.

Null pointer exception: m_rendererNative was nullptr

wx/renderer.h:

Code: Select all

    virtual void DrawTreeItemButton(wxWindow *win,
                                    wxDC& dc,
                                    const wxRect& rect,
                                    int flags = 0) wxOVERRIDE
        { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); }
Stack trace:

Code: Select all

VoukoderR2.prm!wxDelegateRendererNative::DrawTreeItemButton(wxWindow * win, wxDC & dc, const wxRect & rect, int flags) Zeile 444	C++
VoukoderR2.prm!wxPropertyGrid::DrawExpanderButton(wxDC & dc, const wxRect & rect, wxPGProperty * property) Zeile 1935	C++
VoukoderR2.prm!wxPropertyGrid::DoDrawItemsBase(wxDC & dc, const wxRect * itemsRect, bool isBuffered) Zeile 2426	C++
VoukoderR2.prm!wxPropertyGrid::DoDrawItems(wxDC & dc, const wxRect * itemsRect) Zeile 1825	C++
VoukoderR2.prm!wxPropertyGrid::DrawItems(wxDC & dc, unsigned int topItemY, unsigned int bottomItemY, const wxRect * itemsRect) Zeile 1999	C++
VoukoderR2.prm!wxPropertyGrid::OnPaint(wxPaintEvent & __formal) Zeile 1882	C++
VoukoderR2.prm!wxAppConsoleBase::HandleEvent(wxEvtHandler * handler, void(wxEvtHandler::*)(wxEvent &) func, wxEvent & event) Zeile 658	C++
VoukoderR2.prm!wxAppConsoleBase::CallEventHandler(wxEvtHandler * handler, wxEventFunctor & functor, wxEvent & event) Zeile 670	C++
VoukoderR2.prm!wxEvtHandler::ProcessEventIfMatchesId(const wxEventTableEntryBase & entry, wxEvtHandler * handler, wxEvent & event) Zeile 1398	C++
VoukoderR2.prm!wxEventHashTable::HandleEvent(wxEvent & event, wxEvtHandler * self) Zeile 1004	C++
VoukoderR2.prm!wxEvtHandler::TryHereOnly(wxEvent & event) Zeile 1593	C++
VoukoderR2.prm!wxEvtHandler::TryBeforeAndHere(wxEvent & event) Zeile 3892	C++
VoukoderR2.prm!wxEvtHandler::ProcessEventLocally(wxEvent & event) Zeile 1526	C++
VoukoderR2.prm!wxEvtHandler::ProcessEvent(wxEvent & event) Zeile 1499	C++
VoukoderR2.prm!wxScrollHelperEvtHandler::ProcessEvent(wxEvent & event) Zeile 200	C++
VoukoderR2.prm!wxEvtHandler::SafelyProcessEvent(wxEvent & event) Zeile 1617	C++
VoukoderR2.prm!wxWindowBase::HandleWindowEvent(wxEvent & event) Zeile 1540	C++
VoukoderR2.prm!wxWindow::HandlePaint() Zeile 5021	C++
VoukoderR2.prm!wxWindow::MSWHandleMessage(__int64 * result, unsigned int message, unsigned __int64 wParam, __int64 lParam) Zeile 3052	C++
VoukoderR2.prm!wxWindow::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Zeile 3823	C++
VoukoderR2.prm!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Zeile 2909	C++
[Externer Code]	
VoukoderR2.prm!wxWindow::MSWDefWindowProc(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Zeile 2451	C++
VoukoderR2.prm!wxWindow::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Zeile 3829	C++
VoukoderR2.prm!wxListCtrl::MSWWindowProc(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Zeile 3237	C++
VoukoderR2.prm!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Zeile 2909	C++
[Externer Code]	
VoukoderR2.prm!wxWindow::MSWSafeIsDialogMessage(tagMSG * msg) Zeile 2774	C++
VoukoderR2.prm!wxWindow::MSWProcessMessage(tagMSG * pMsg) Zeile 2658	C++
VoukoderR2.prm!wxGUIEventLoop::PreProcessMessage(tagMSG * msg) Zeile 145	C++
VoukoderR2.prm!wxGUIEventLoop::ProcessMessage(tagMSG * msg) Zeile 163	C++
VoukoderR2.prm!wxGUIEventLoop::Dispatch() Zeile 229	C++
VoukoderR2.prm!wxEventLoopManual::ProcessEvents() Zeile 237	C++
VoukoderR2.prm!wxEventLoopManual::DoRun() Zeile 283	C++
VoukoderR2.prm!wxEventLoopBase::Run() Zeile 90	C++
VoukoderR2.prm!wxDialogModalData::RunLoop() Zeile 63	C++
VoukoderR2.prm!wxDialog::ShowModal() Zeile 192	C++
VoukoderR2.prm!Gui::OpenVoukoderConfigDialog(exParamButtonRec * paramButtonRecP) Zeile 314	C++
VoukoderR2.prm!Gui::ButtonAction(exParamButtonRec * paramButtonRecP) Zeile 280	C++
VoukoderR2.prm!CPremierePluginApp::buttonAction(exParamButtonRec * paramButtonRecP) Zeile 526	C++
VoukoderR2.prm!xSDKExport(int selector, exportStdParms * stdParmsP, void * param1, void * param2) Zeile 143	C++
[Externer Code]

Re: wxPropertyGrid issues with Classic Windows Theme

Posted: Tue Apr 30, 2019 8:21 am
by doublemax

Code: Select all

Null pointer exception: m_rendererNative was nullptr
That's very strange, as it's a reference and not a pointer.

While looking through the propertygrid source, i saw that it has an option wxPG_USE_RENDERER_NATIVE. You could try rebuilding wxWidgets with wxPG_USE_RENDERER_NATIVE=0. But i'm afraid it might just shift the error to another place.

As it only happens with the classic theme and only on the second start, maybe the problem is related to the context activation code. The code that gets the activation context is only called once when the DLL is loaded. Check if ActivateActCtx() returns false on the second call, and if yes, check the error code. Or try calling GetCurrentActCtx() each time, not only when the DLL is loaded.