debugger: Move Skia initialization out of the GUI widget class

Move Skia initialization out of the GUI widget class to the
main function.

Before, Skia may have been already called before the SkGraphics::Init
was run.

Review URL: https://codereview.chromium.org/822583003
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index cb8ae10..1d37c7d 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -7,16 +7,12 @@
 
 #include "SkDebuggerGUI.h"
 #include "SkForceLinking.h"
-#include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include <QListWidgetItem>
 #include "PictureRenderer.h"
 #include "SkPicturePlayback.h"
 #include "SkPictureRecord.h"
 #include "SkPictureData.h"
 
-__SK_FORCE_IMAGE_DECODER_LINKING;
-
 #if defined(SK_BUILD_FOR_WIN32)
     #include "SysTimer_windows.h"
 #elif defined(SK_BUILD_FOR_MAC)
@@ -124,12 +120,6 @@
     fMenuEdit.setDisabled(true);
     fMenuNavigate.setDisabled(true);
     fMenuView.setDisabled(true);
-
-    SkGraphics::Init();
-}
-
-SkDebuggerGUI::~SkDebuggerGUI() {
-    SkGraphics::Term();
 }
 
 void SkDebuggerGUI::actionBreakpoints() {
diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h
index 695a858..6f6f647 100644
--- a/debugger/QT/SkDebuggerGUI.h
+++ b/debugger/QT/SkDebuggerGUI.h
@@ -56,8 +56,6 @@
      */
     SkDebuggerGUI(QWidget *parent = 0);
 
-    ~SkDebuggerGUI();
-
     /**
         Updates the directory widget with the latest directory path stored in
         the global class variable fPath.
diff --git a/debugger/debuggermain.cpp b/debugger/debuggermain.cpp
index d537d36..0aec02b 100644
--- a/debugger/debuggermain.cpp
+++ b/debugger/debuggermain.cpp
@@ -7,8 +7,13 @@
  */
 
 #include "SkDebuggerGUI.h"
+#include "SkForceLinking.h"
+#include "SkGraphics.h"
 #include <QApplication>
 
+__SK_FORCE_IMAGE_DECODER_LINKING;
+
+
 static void usage(const char * argv0) {
     SkDebugf("%s <input> \n", argv0);
     SkDebugf("    [--help|-h]: show this help message\n");
@@ -23,6 +28,7 @@
     // constuction.  However, the components Qt calls (X11 libs, ..) will override that.
     setenv("LC_NUMERIC", "C", 1);
 #endif
+    SkGraphics::Init();
     QApplication a(argc, argv);
     QStringList argList = a.arguments();
 
@@ -60,5 +66,7 @@
     }
 
     w.show();
-    return a.exec();
+    int result = a.exec();
+    SkGraphics::Term();
+    return result;
 }