Author Topic: Is Manager::GetCmdLineParser() needed and does it work?  (Read 3128 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7176
    • My Best Post
Is Manager::GetCmdLineParser() needed and does it work?
« on: January 12, 2009, 12:02:25 am »
FYI:

Using the debug build of wxWidgets, I get messages/warnings on this method Manager::GetCmdLineParser().

Can anyone verify this method stills works with wxWidgets 2.8?

If it does not work, I suggest removing it.

From wxWidgets 2.9 docs. But, it seems to exist in  wxWidgets 2.8 docs also.
Quote
You can also use wxApp's default command line processing just overriding wxAppConsole::OnInitCmdLine() and wxAppConsole::OnCmdLineParsed().

Below is the patch I am using to do wxWidgets debug builds of Code::Blocks.

Code
Index: src/sdk/manager.cpp
===================================================================
--- src/sdk/manager.cpp (revision 5394)
+++ src/sdk/manager.cpp (working copy)
@@ -402,11 +402,6 @@
     }
 }
 
-wxCmdLineParser* Manager::GetCmdLineParser()
-{
- return &m_CmdLineParser;
-}
-
 void Manager::RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor)
 {
  m_EventSinks[eventType].push_back(functor);
@@ -505,4 +500,3 @@
 bool Manager::appShuttingDown = false;
 bool Manager::blockYields = false;
 bool Manager::isBatch = false;
-wxCmdLineParser Manager::m_CmdLineParser;
Index: src/include/manager.h
===================================================================
--- src/include/manager.h (revision 5394)
+++ src/include/manager.h (working copy)
@@ -46,7 +46,6 @@
     static bool appShuttingDown;
     static bool blockYields;
     static bool isBatch;
-    static wxCmdLineParser m_CmdLineParser;
 
     Manager();
     ~Manager();
@@ -135,8 +134,6 @@
     static void AddonToolBar(wxToolBar* toolBar,wxString resid);
     static bool isToolBar16x16(wxToolBar* toolBar);
 
-    static wxCmdLineParser* GetCmdLineParser();
-
  // event sinks
  void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor);
  void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksDockEvent>* functor);
Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 5394)
+++ src/src/app.cpp (working copy)
@@ -986,7 +986,7 @@
     bool filesInCmdLine = false;
 
 #if wxUSE_CMDLINE_PARSER
-    wxCmdLineParser& parser = *Manager::GetCmdLineParser();
+    wxCmdLineParser& parser = *(new wxCmdLineParser()); //*Manager::GetCmdLineParser();
     parser.SetDesc(cmdLineDesc);
     parser.SetCmdLine(argc, argv);
     // wxApp::argc is a wxChar**
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org