debugger: Move Skia initialization out of the GUI widget class
authorkkinnunen <kkinnunen@nvidia.com>
Fri, 2 Jan 2015 15:24:14 +0000 (07:24 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 2 Jan 2015 15:24:14 +0000 (07:24 -0800)
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

debugger/QT/SkDebuggerGUI.cpp
debugger/QT/SkDebuggerGUI.h
debugger/debuggermain.cpp

index cb8ae10..1d37c7d 100644 (file)
@@ -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 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
     fMenuEdit.setDisabled(true);
     fMenuNavigate.setDisabled(true);
     fMenuView.setDisabled(true);
-
-    SkGraphics::Init();
-}
-
-SkDebuggerGUI::~SkDebuggerGUI() {
-    SkGraphics::Term();
 }
 
 void SkDebuggerGUI::actionBreakpoints() {
index 695a858..6f6f647 100644 (file)
@@ -56,8 +56,6 @@ public:
      */
     SkDebuggerGUI(QWidget *parent = 0);
 
-    ~SkDebuggerGUI();
-
     /**
         Updates the directory widget with the latest directory path stored in
         the global class variable fPath.
index d537d36..0aec02b 100644 (file)
@@ -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 @@ int main(int argc, char *argv[]) {
     // 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 @@ int main(int argc, char *argv[]) {
     }
 
     w.show();
-    return a.exec();
+    int result = a.exec();
+    SkGraphics::Term();
+    return result;
 }