From 42ab2f95f82522085fdc4ffc8bad1fb182b5ec9c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 18 Feb 2016 07:42:57 -0500 Subject: Find/switch a bunch of other "delete" calls on QWidgets to the Qt deleteLater() function instead. This seems to fix the start menu category change crash with Qt 5.5.1 --- lumina-desktop/LPanel.cpp | 4 ++-- lumina-desktop/panel-plugins/systemstart/StartMenu.cpp | 5 +++-- lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 6 +++--- lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp index b0ead2e0..2940482c 100644 --- a/lumina-desktop/LPanel.cpp +++ b/lumina-desktop/LPanel.cpp @@ -67,7 +67,7 @@ void LPanel::prepareToClose(){ for(int i=0; iAboutToClose(); //any last cleanup for this plugin layout->takeAt(i); //remove from the layout - delete PLUGINS.takeAt(i); //delete the actual widget + PLUGINS.takeAt(i)->deleteLater(); //delete the actual widget LSession::processEvents(); i--; //need to back up one space to not miss another plugin } @@ -262,7 +262,7 @@ void LPanel::UpdatePanel(bool geomonly){ static_cast(PLUGINS[i])->stop(); } layout->takeAt(i); //remove from the layout - delete PLUGINS.takeAt(i); //delete the actual widget + PLUGINS.takeAt(i)->deleteLater(); //delete the actual widget LSession::processEvents(); i--; //need to back up one space to not miss another plugin } diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index 2c5565df..9f172096 100644 --- a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -149,8 +149,7 @@ void StartMenu::UpdateQuickLaunch(QString path, bool keep){ // PRIVATE FUNCTIONS // ========================== void StartMenu::ClearScrollArea(QScrollArea *area){ - QWidget *wgt = area->takeWidget(); - delete wgt; //delete the widget and all children + area->takeWidget()->deleteLater(); area->setWidget( new QWidget() ); //create a new widget in the scroll area area->widget()->setContentsMargins(0,0,0,0); QVBoxLayout *layout = new QVBoxLayout; @@ -257,6 +256,7 @@ void StartMenu::UpdateApps(){ connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); } }else{ + //qDebug() << "Show Apps For category:" << CCat; //Show the "go back" button ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), CCat, "chcat::::"+CCat, true); //if(!it->gooditem){ continue; } //invalid for some reason @@ -265,6 +265,7 @@ void StartMenu::UpdateApps(){ //Show apps for this cat QList apps = sysapps->value(CCat); for(int i=0; iscroll_apps->widget(), apps[i] ); if(!it->gooditem){ continue; } //invalid for some reason ui->scroll_apps->widget()->layout()->addWidget(it); diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index a921d314..b6af4451 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -65,7 +65,7 @@ void LSysTray::stop(){ trayIcons[i]->detachApp(); TrayIcon *cont = trayIcons.takeAt(i); LI->removeWidget(cont); - delete cont; + cont->deleteLater(); } } //Now let some other visual tray take over @@ -92,7 +92,7 @@ void LSysTray::checkAll(){ TrayIcon *cont = trayIcons.takeAt(i); cont->cleanup(); LI->removeWidget(cont); - delete cont; + cont->deleteLater(); i--; //List size changed //Re-adjust the maximum widget size to account for what is left if(this->layout()->direction()==QBoxLayout::LeftToRight){ @@ -131,7 +131,7 @@ void LSysTray::checkAll(){ qDebug() << " - Invalid Tray App: Could Not Embed:"; trayIcons.takeAt(trayIcons.length()-1); //Always at the end LI->removeWidget(cont); - delete cont; + cont->deleteLater(); continue; } LI->update(); //make sure there is no blank space in the layout diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp index be3e665a..3e31a534 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp @@ -57,7 +57,7 @@ void LTaskManagerPlugin::UpdateButtons(){ //Remove the entire button //qDebug() << "Window Closed: Remove Button" ; this->layout()->takeAt(i); //remove from the layout - delete BUTTONS.takeAt(i); + BUTTONS.takeAt(i)->deleteLater(); i--; updated = true; //prevent updating a removed button break; //break out of the button->window loop -- cgit