From 2fcd8b3d7b984403f29579691ff96da0e813b6ad Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 14 Sep 2012 02:31:09 -0500 Subject: Fix corrupt application name and crash on exit --- plugin/simplestyle.cpp | 26 +++++++++----------------- plugin/simplestyle.h | 17 +++-------------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/plugin/simplestyle.cpp b/plugin/simplestyle.cpp index 6161d26..583d4bd 100644 --- a/plugin/simplestyle.cpp +++ b/plugin/simplestyle.cpp @@ -134,7 +134,7 @@ static QString TDEFileDialogSelectDirectory(QWidget *parent, const QString &capt #define NO_QT3_EQUIVALENT can_override = false; #define DO_NOT_DRAW can_override = true; do_not_draw = true; -Qt4TDEStyle::Qt4TDEStyle() +Qt4TDEStyle::Qt4TDEStyle() : m_aboutData(NULL), m_tdeApplication(NULL) { enable_debug_warnings = (getenv("DEBUG_TDEQT4_THEME_ENGINE") != NULL); @@ -148,7 +148,9 @@ Qt4TDEStyle::Qt4TDEStyle() argv[0] = (char*) malloc(sizeof(char) * 19); strncpy(argv[0], "Qt4TDEStyle", 19); - m_aboutData = new KAboutData("Qt4TDEStyle", I18N_NOOP(convertQt4ToTQt3String(qApp->applicationName())), "v0.1", + m_qt4ApplicationName = convertQt4ToTQt3String(qApp->applicationName()); + + m_aboutData = new KAboutData("Qt4TDEStyle", I18N_NOOP(m_qt4ApplicationName.ascii()), "v0.1", "TDE Qt4 theme engine", KAboutData::License_GPL, "(c) 2012, Timothy Pearson", "message goes here", 0 /* TODO: Website */, "kb9vqf@pearsoncomputing.net"); @@ -156,7 +158,7 @@ Qt4TDEStyle::Qt4TDEStyle() // Qt4 can be SO STUPID sometimes...why can't I get the X11 display directly from qApp?!?!?? QWidget myhackedwidget; - new KApplication(myhackedwidget.x11Info().display()); + m_tdeApplication = new KApplication(myhackedwidget.x11Info().display()); } // Set the Qt4 icon set to the TDE icon set @@ -251,21 +253,7 @@ Qt4TDEStyle::~Qt4TDEStyle() // Delete interface widgets // Widgets are deleted when their parent is deleted...these lines will cause a crash on exit // delete m_tqt3generic_widget; -// delete m_tqt3progressbar_widget; -// delete m_tqt3tabbar_widget; -// delete m_tqt3radiobutton_widget; -// delete m_tqt3checkbox_widget; -// delete m_tqt3popupmenu_widget; -// delete m_tqt3combobox_widget; -// delete m_tqt3slider_widget; -// delete m_tqt3scrollbar_widget; -// delete m_tqt3spinbox_widget; -// delete m_tqt3spinwidget_widget; // delete m_tqt3window_widget; -// delete m_tqt3titlebar_widget; -// delete m_tqt3menubar_widget; -// delete m_tqt3toolbox_widget; -// delete m_tqt3toolbutton_widget; // FIXME // Verify I'm not leaking memory like a sieve when this is commented out!!! @@ -275,6 +263,10 @@ Qt4TDEStyle::~Qt4TDEStyle() delete m_internalTQt3WidgetCache; delete m_internalTQt3PixmapCache; + if (m_tdeApplication) { + delete m_tdeApplication; + } + // FIXME // Do I need to delete this? // delete m_aboutData; diff --git a/plugin/simplestyle.h b/plugin/simplestyle.h index 7ce2092..e4c7923 100644 --- a/plugin/simplestyle.h +++ b/plugin/simplestyle.h @@ -46,6 +46,7 @@ class TQToolBox; class TQToolButton; class KAboutData; +class KApplication; class TQPixmapCache; typedef TQIntCache TQWidgetCache; @@ -84,21 +85,7 @@ private: TQWidget* m_tqt3parent_widget; TQWidget* m_tqt3generic_widget; -// mutable TQTabBar* m_tqt3tabbar_widget; -// mutable TQRadioButton* m_tqt3radiobutton_widget; -// mutable TQCheckBox* m_tqt3checkbox_widget; -// mutable TQProgressBar* m_tqt3progressbar_widget; -// mutable TQPopupMenu* m_tqt3popupmenu_widget; -// mutable TQComboBox* m_tqt3combobox_widget; -// mutable TQSlider* m_tqt3slider_widget; -// mutable TQScrollBar* m_tqt3scrollbar_widget; -// mutable TQSpinBox* m_tqt3spinbox_widget; -// mutable TQSpinWidget* m_tqt3spinwidget_widget; TQWidget* m_tqt3window_widget; -// mutable TQTitleBar* m_tqt3titlebar_widget; -// mutable TQMenuBar* m_tqt3menubar_widget; -// mutable TQToolBox* m_tqt3toolbox_widget; -// mutable TQToolButton* m_tqt3toolbutton_widget; int m_tqt3IconSize_NoGroup; int m_tqt3IconSize_Desktop; @@ -120,6 +107,8 @@ private: mutable TQWidget* m_previousTQt3InterfaceWidget; KAboutData* m_aboutData; + KApplication* m_tdeApplication; + TQString m_qt4ApplicationName; TQPixmapCache* m_internalTQt3PixmapCache; TQWidgetCache* m_internalTQt3WidgetCache; -- cgit v1.2.1