SVN commit 488411 by cgilles:
Digikam from trunk : fix memory leak : KAboutData isn't cleaned automaticly by KDE lib. CCMAIL: [hidden email] M +7 -1 imagedialogbase.cpp M +2 -0 imagedialogbase.h M +42 -37 imageguidedialog.cpp M +2 -0 imageguidedialog.h --- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imagedialogbase.cpp #488410:488411 @@ -68,6 +68,8 @@ { kapp->setOverrideCursor( KCursor::waitCursor() ); + m_about = 0L; + setButtonWhatsThis ( Default, i18n("<p>Reset all filter parameters to their default values.") ); setButtonWhatsThis ( User3, i18n("<p>Load all filter parameters from settings text file.") ); setButtonWhatsThis ( User2, i18n("<p>Save all filter parameters to settings text file.") ); @@ -94,6 +96,9 @@ ImageDialogBase::~ImageDialogBase() { saveDialogSize(m_name + QString::QString(" Tool Dialog")); + + if (m_about) + delete m_about; } void ImageDialogBase::slotHelp() @@ -103,8 +108,9 @@ void ImageDialogBase::setAboutData(KAboutData *about) { + m_about = about; QPushButton *helpButton = actionButton( Help ); - KHelpMenu* helpMenu = new KHelpMenu(this, about, false); + KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false); helpMenu->menu()->removeItemAt(0); helpMenu->menu()->insertItem(i18n("Plugin Handbook"), this, SLOT(slotHelp()), 0, -1, 0); helpButton->setPopup( helpMenu->menu() ); --- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imagedialogbase.h #488410:488411 @@ -60,6 +60,8 @@ QWidget *m_parent; QString m_name; + + KAboutData *m_about; private slots: --- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.cpp #488410:488411 @@ -72,6 +72,7 @@ m_currentRenderingMode = NoneRendering; m_timer = 0L; m_threadedFilter = 0L; + m_about = 0L; QString whatsThis; setButtonWhatsThis ( Default, i18n("<p>Reset all filter parameters to their default values.") ); @@ -164,6 +165,9 @@ if (m_threadedFilter) delete m_threadedFilter; + + if (m_about) + delete m_about; } void ImageGuideDialog::readSettings(void) @@ -212,8 +216,9 @@ void ImageGuideDialog::setAboutData(KAboutData *about) { + m_about = about; QPushButton *helpButton = actionButton( Help ); - KHelpMenu* helpMenu = new KHelpMenu(this, about, false); + KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false); helpMenu->menu()->removeItemAt(0); helpMenu->menu()->insertItem(i18n("Plugin Handbook"), this, SLOT(slotHelp()), 0, -1, 0); helpButton->setPopup( helpMenu->menu() ); @@ -234,15 +239,15 @@ void ImageGuideDialog::slotResized(void) { if (m_currentRenderingMode == FinalRendering) - { + { m_imagePreviewWidget->update(); return; - } + } else if (m_currentRenderingMode == PreviewRendering) - { + { if (m_threadedFilter) m_threadedFilter->stopComputation(); - } + } QTimer::singleShot(0, this, SLOT(slotEffect())); } @@ -263,12 +268,12 @@ void ImageGuideDialog::slotCancel() { if (m_currentRenderingMode != NoneRendering) - { + { if (m_threadedFilter) m_threadedFilter->stopComputation(); kapp->restoreOverrideCursor(); - } + } done(Cancel); } @@ -276,12 +281,12 @@ void ImageGuideDialog::closeEvent(QCloseEvent *e) { if (m_currentRenderingMode != NoneRendering) - { + { if (m_threadedFilter) m_threadedFilter->stopComputation(); kapp->restoreOverrideCursor(); - } + } e->accept(); } @@ -294,10 +299,10 @@ void ImageGuideDialog::slotTimer() { if (m_timer) - { + { m_timer->stop(); delete m_timer; - } + } m_timer = new QTimer( this ); connect( m_timer, SIGNAL(timeout()), @@ -353,50 +358,50 @@ if (!d) return; if (d->starting) // Computation in progress ! - { + { m_progressBar->setValue(d->progress); - } + } else + { + if (d->success) // Computation Completed ! { - if (d->success) // Computation Completed ! + switch (m_currentRenderingMode) { - switch (m_currentRenderingMode) - { - case PreviewRendering: - { - kdDebug() << "Preview " << m_name << " completed..." << endl; - putPreviewData(); - abortPreview(); - break; - } + case PreviewRendering: + { + kdDebug() << "Preview " << m_name << " completed..." << endl; + putPreviewData(); + abortPreview(); + break; + } - case FinalRendering: - { - kdDebug() << "Final" << m_name << " completed..." << endl; - putFinalData(); - kapp->restoreOverrideCursor(); - accept(); - break; - } - } + case FinalRendering: + { + kdDebug() << "Final" << m_name << " completed..." << endl; + putFinalData(); + kapp->restoreOverrideCursor(); + accept(); + break; + } } + } else // Computation Failed ! + { + switch (m_currentRenderingMode) { - switch (m_currentRenderingMode) + case PreviewRendering: { - case PreviewRendering: - { kdDebug() << "Preview " << m_name << " failed..." << endl; // abortPreview() must be call here for set progress bar to 0 properly. abortPreview(); break; - } + } case FinalRendering: break; - } } } + } delete d; } --- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.h #488410:488411 @@ -98,6 +98,8 @@ KProgress *m_progressBar; KColorButton *m_guideColorBt; + + KAboutData *m_about; private slots: _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |