1

I started using wxWidgets and everything seemed to work fine until I wanted to use "wxGenericDirCtrl". When I create an object of wxGenericDirCtrl my program throws an exception stating that "wxTheFileIconsTable was nullptr" in Release mode and "this was nullptr" in Debug mode. I've tried using different versions of wxWidgets (3.0.4 - 3.1.3) but none of them worked.

Here's a screenshot of an error that I get

2
  • that screenshot is not helpful. What is the backtrace at the time of the crash? What is you environment (OS, IDE, toolkit)? How did you build the library? Does dialogs sample works for you? What feature you are looking for in the generic control that does not present in the native one? Commented Jan 25, 2020 at 1:23
  • 1
    wxTheFileIconsTable can only be null if you don't initialize the library correctly. Do you use the standard wxIMPLEMENT_APP() macro or do you use some custom initialization code? You need to show it in this case. Commented Jan 25, 2020 at 12:14

1 Answer 1

1

I was initializing frame in the application's constructor instead of doing it in OnInit function.

My code looked like this:

App::App() : m_Frame(new Frame) { } bool App::OnInit() { m_Frame->Show(); return true; } 

and it should've looked like this:

bool App::OnInit() { m_Frame = new Frame; m_Frame->Show(); return true; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.