diff --git a/common/include/Utilities/AppTrait.h b/common/include/Utilities/AppTrait.h
new file mode 100644
index 0000000000..005f157999
--- /dev/null
+++ b/common/include/Utilities/AppTrait.h
@@ -0,0 +1,44 @@
+/* PCSX2 - PS2 Emulator for PCs
+ * Copyright (C) 2002-2014 PCSX2 Dev Team
+ *
+ * PCSX2 is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with PCSX2.
+ * If not, see .
+ */
+
+#pragma once
+
+#include
+
+// --------------------------------------------------------------------------------------
+// Pcsx2AppTraits
+// --------------------------------------------------------------------------------------
+// Overrides and customizes some default wxWidgets behaviors. This class is instanized by
+// calls to Pcsx2App::CreateTraits(), which is called from wxWidgets as-needed. wxWidgets
+// does cache an instance of the traits, so the object construction need not be trivial
+// (translation: it can be complicated-ish -- it won't affect performance).
+//
+class Pcsx2AppTraits : public wxGUIAppTraits
+{
+ typedef wxGUIAppTraits _parent;
+
+public:
+ virtual ~Pcsx2AppTraits() {}
+ wxMessageOutput* CreateMessageOutput();
+
+#ifdef wxUSE_STDPATHS
+#if wxMAJOR_VERSION < 3
+ wxStandardPathsBase& GetStandardPaths();
+#else
+ wxStandardPaths& GetStandardPaths();
+#endif
+#endif
+};
+
diff --git a/common/include/Utilities/wxAppWithHelpers.h b/common/include/Utilities/wxAppWithHelpers.h
index ea6a29e99f..b9deec52b3 100644
--- a/common/include/Utilities/wxAppWithHelpers.h
+++ b/common/include/Utilities/wxAppWithHelpers.h
@@ -20,6 +20,7 @@
#include "Threading.h"
#include "wxGuiTools.h"
#include "pxEvents.h"
+#include "AppTrait.h"
using namespace Threading;
@@ -81,6 +82,8 @@ public:
wxAppWithHelpers();
virtual ~wxAppWithHelpers() {}
+ wxAppTraits* CreateTraits();
+
void CleanUp();
void DeleteObject( BaseDeletableObject& obj );
diff --git a/common/src/Utilities/wxAppWithHelpers.cpp b/common/src/Utilities/wxAppWithHelpers.cpp
index 6092142f2b..e86e9edf31 100644
--- a/common/src/Utilities/wxAppWithHelpers.cpp
+++ b/common/src/Utilities/wxAppWithHelpers.cpp
@@ -664,6 +664,18 @@ void wxAppWithHelpers::OnDeleteObject( wxCommandEvent& evt )
delete (BaseDeletableObject*)evt.GetClientData();
}
+// In theory we create a Pcsx2App object which inherit from wxAppWithHelpers,
+// so Pcsx2App::CreateTraits must be used instead.
+//
+// However it doesn't work this way because wxAppWithHelpers constructor will
+// be called first. This constructor will build some wx objects (here wxTimer)
+// that require a trait. In others word, wxAppWithHelpers::CreateTraits will be
+// called instead
+wxAppTraits* wxAppWithHelpers::CreateTraits()
+{
+ return new Pcsx2AppTraits;
+}
+
// Threads have their own deletion handler that propagates exceptions thrown by the thread to the UI.
// (thus we have a fairly automatic threaded exception system!)
void wxAppWithHelpers::OnDeleteThread( wxCommandEvent& evt )
diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h
index c552fce261..ad9330d6e4 100644
--- a/pcsx2/gui/App.h
+++ b/pcsx2/gui/App.h
@@ -362,31 +362,6 @@ public:
}
};
-// --------------------------------------------------------------------------------------
-// Pcsx2AppTraits
-// --------------------------------------------------------------------------------------
-// Overrides and customizes some default wxWidgets behaviors. This class is instanized by
-// calls to Pcsx2App::CreateTraits(), which is called from wxWidgets as-needed. wxWidgets
-// does cache an instance of the traits, so the object construction need not be trivial
-// (translation: it can be complicated-ish -- it won't affect performance).
-//
-class Pcsx2AppTraits : public wxGUIAppTraits
-{
- typedef wxGUIAppTraits _parent;
-
-public:
- virtual ~Pcsx2AppTraits() {}
- wxMessageOutput* CreateMessageOutput();
-
-#ifdef wxUSE_STDPATHS
-#if wxMAJOR_VERSION < 3
- wxStandardPathsBase& GetStandardPaths();
-#else
- wxStandardPaths& GetStandardPaths();
-#endif
-#endif
-};
-
// =====================================================================================================
// Pcsx2App - main wxApp class
// =====================================================================================================
diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp
index 286bbc92f7..b5548af4b0 100644
--- a/pcsx2/gui/AppMain.cpp
+++ b/pcsx2/gui/AppMain.cpp
@@ -31,6 +31,7 @@
#include "Debugger/DisassemblyDialog.h"
#include "Utilities/IniInterface.h"
+#include "Utilities/AppTrait.h"
#include