mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Memory Management : Adjustment and fixes
Add release of several static singleton objects Fix several minor memory leaks
This commit is contained in:
parent
7a2a297648
commit
0e57cfe201
@ -68,9 +68,9 @@ endif()
|
|||||||
# Defining all the source (and header) files
|
# Defining all the source (and header) files
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
set(CODE_HEADER_FILES)
|
set(CODE_HEADER_FILES RiaMainTools.h)
|
||||||
|
|
||||||
set(CODE_SOURCE_FILES RiaMain.cpp)
|
set(CODE_SOURCE_FILES RiaMain.cpp RiaMainTools.cpp)
|
||||||
|
|
||||||
if(RESINSIGHT_ENABLE_GRPC)
|
if(RESINSIGHT_ENABLE_GRPC)
|
||||||
list(APPEND CODE_HEAD_FILES RiaGrpcConsoleApplication.h
|
list(APPEND CODE_HEAD_FILES RiaGrpcConsoleApplication.h
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "RiaArgumentParser.h"
|
#include "RiaArgumentParser.h"
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
|
#include "RiaMainTools.h"
|
||||||
|
|
||||||
#ifdef ENABLE_GRPC
|
#ifdef ENABLE_GRPC
|
||||||
#include "RiaGrpcConsoleApplication.h"
|
#include "RiaGrpcConsoleApplication.h"
|
||||||
@ -26,6 +27,7 @@
|
|||||||
#include "RiaConsoleApplication.h"
|
#include "RiaConsoleApplication.h"
|
||||||
#include "RiaGuiApplication.h"
|
#include "RiaGuiApplication.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cvfProgramOptions.h"
|
#include "cvfProgramOptions.h"
|
||||||
#include "cvfqtUtils.h"
|
#include "cvfqtUtils.h"
|
||||||
|
|
||||||
@ -66,8 +68,12 @@ int main( int argc, char* argv[] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// Global initialization
|
||||||
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
|
RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) );
|
||||||
|
|
||||||
|
// Create feature manager before the application object is created
|
||||||
|
RiaMainTools::initializeSingletons();
|
||||||
|
|
||||||
std::unique_ptr<RiaApplication> app( createApplication( argc, argv ) );
|
std::unique_ptr<RiaApplication> app( createApplication( argc, argv ) );
|
||||||
|
|
||||||
cvf::ProgramOptions progOpt;
|
cvf::ProgramOptions progOpt;
|
||||||
@ -112,6 +118,9 @@ int main( int argc, char* argv[] )
|
|||||||
// Make sure project is closed to avoid assert and crash in destruction of widgets
|
// Make sure project is closed to avoid assert and crash in destruction of widgets
|
||||||
app->closeProject();
|
app->closeProject();
|
||||||
|
|
||||||
|
app.reset();
|
||||||
|
RiaMainTools::releaseSingletonAndFactoryObjects();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR )
|
else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR )
|
||||||
@ -147,6 +156,9 @@ int main( int argc, char* argv[] )
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.reset();
|
||||||
|
RiaMainTools::releaseSingletonAndFactoryObjects();
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
61
ApplicationExeCode/RiaMainTools.cpp
Normal file
61
ApplicationExeCode/RiaMainTools.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022 Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RiaMainTools.h"
|
||||||
|
#include "RiaRegressionTestRunner.h"
|
||||||
|
#include "RiaSocketCommand.h"
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
|
#include "cafPdmDefaultObjectFactory.h"
|
||||||
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaMainTools::initializeSingletons()
|
||||||
|
{
|
||||||
|
caf::CmdFeatureManager::createSingleton();
|
||||||
|
RiaRegressionTestRunner::createSingleton();
|
||||||
|
caf::PdmDefaultObjectFactory::createSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// This method is used to release memory allocated by static functions. This enables use of memory allocation tools
|
||||||
|
/// after the application has closed down.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaMainTools::releaseSingletonAndFactoryObjects()
|
||||||
|
{
|
||||||
|
caf::CmdFeatureManager::deleteSingleton();
|
||||||
|
RiaRegressionTestRunner::deleteSingleton();
|
||||||
|
caf::PdmDefaultObjectFactory::deleteSingleton();
|
||||||
|
|
||||||
|
{
|
||||||
|
auto factory = caf::Factory<caf::PdmUiFieldEditorHandle, QString>::instance();
|
||||||
|
factory->deleteCreatorObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto factory = caf::Factory<caf::CmdFeature, std::string>::instance();
|
||||||
|
factory->deleteCreatorObjects();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto factory = caf::Factory<RiaSocketCommand, QString>::instance();
|
||||||
|
factory->deleteCreatorObjects();
|
||||||
|
}
|
||||||
|
}
|
25
ApplicationExeCode/RiaMainTools.h
Normal file
25
ApplicationExeCode/RiaMainTools.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022 Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class RiaMainTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void initializeSingletons();
|
||||||
|
static void releaseSingletonAndFactoryObjects();
|
||||||
|
};
|
@ -189,8 +189,6 @@ RiaGuiApplication::RiaGuiApplication( int& argc, char** argv )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaGuiApplication::~RiaGuiApplication()
|
RiaGuiApplication::~RiaGuiApplication()
|
||||||
{
|
{
|
||||||
deleteMainPlotWindow();
|
|
||||||
deleteMainWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -925,7 +923,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow()
|
|||||||
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_mainWindow;
|
return m_mainWindow.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -933,7 +931,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuMainWindow* RiaGuiApplication::mainWindow()
|
RiuMainWindow* RiaGuiApplication::mainWindow()
|
||||||
{
|
{
|
||||||
return m_mainWindow;
|
return m_mainWindow.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -947,7 +945,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateMainPlotWindow()
|
|||||||
m_mainPlotWindow->initializeGuiNewProjectLoaded();
|
m_mainPlotWindow->initializeGuiNewProjectLoaded();
|
||||||
loadAndUpdatePlotData();
|
loadAndUpdatePlotData();
|
||||||
}
|
}
|
||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -962,7 +960,7 @@ void RiaGuiApplication::createMainWindow()
|
|||||||
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWindow = new RiuMainWindow;
|
m_mainWindow = std::make_unique<RiuMainWindow>();
|
||||||
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
||||||
m_mainWindow->setWindowTitle( "ResInsight " + platform );
|
m_mainWindow->setWindowTitle( "ResInsight " + platform );
|
||||||
m_mainWindow->setDefaultWindowSize();
|
m_mainWindow->setDefaultWindowSize();
|
||||||
@ -972,18 +970,6 @@ void RiaGuiApplication::createMainWindow()
|
|||||||
m_mainWindow->showWindow();
|
m_mainWindow->showWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaGuiApplication::deleteMainWindow()
|
|
||||||
{
|
|
||||||
if ( m_mainWindow )
|
|
||||||
{
|
|
||||||
delete m_mainWindow;
|
|
||||||
m_mainWindow = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -996,26 +982,13 @@ void RiaGuiApplication::createMainPlotWindow()
|
|||||||
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainPlotWindow = new RiuPlotMainWindow;
|
m_mainPlotWindow = std::make_unique<RiuPlotMainWindow>();
|
||||||
m_mainPlotWindow->setWindowTitle( "Plots - ResInsight" );
|
m_mainPlotWindow->setWindowTitle( "Plots - ResInsight" );
|
||||||
m_mainPlotWindow->setDefaultWindowSize();
|
m_mainPlotWindow->setDefaultWindowSize();
|
||||||
m_mainPlotWindow->loadWinGeoAndDockToolBarLayout();
|
m_mainPlotWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
m_mainPlotWindow->hideAllDockWidgets();
|
m_mainPlotWindow->hideAllDockWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaGuiApplication::deleteMainPlotWindow()
|
|
||||||
{
|
|
||||||
if ( m_mainPlotWindow )
|
|
||||||
{
|
|
||||||
m_mainPlotWindow->setParent( nullptr );
|
|
||||||
delete m_mainPlotWindow;
|
|
||||||
m_mainPlotWindow = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1052,7 +1025,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow()
|
|||||||
m_mainPlotWindow->restoreDockWidgetVisibilities();
|
m_mainPlotWindow->restoreDockWidgetVisibilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1060,7 +1033,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow()
|
RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow()
|
||||||
{
|
{
|
||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1069,9 +1042,9 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow()
|
|||||||
RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID )
|
RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID )
|
||||||
{
|
{
|
||||||
if ( mainWindowID == 0 )
|
if ( mainWindowID == 0 )
|
||||||
return m_mainWindow;
|
return m_mainWindow.get();
|
||||||
else if ( mainWindowID == 1 )
|
else if ( mainWindowID == 1 )
|
||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow.get();
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1478,7 +1451,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
|||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::StandardButton reply;
|
QMessageBox::StandardButton reply;
|
||||||
reply = QMessageBox::question( m_mainWindow,
|
reply = QMessageBox::question( m_mainWindow.get(),
|
||||||
QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ),
|
QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ),
|
||||||
QString( "You have changed default %1 and have existing views or plots with "
|
QString( "You have changed default %1 and have existing views or plots with "
|
||||||
"different settings.\n" )
|
"different settings.\n" )
|
||||||
|
@ -155,9 +155,7 @@ private:
|
|||||||
void setWindowCaptionFromAppState();
|
void setWindowCaptionFromAppState();
|
||||||
|
|
||||||
void createMainWindow();
|
void createMainWindow();
|
||||||
void deleteMainWindow();
|
|
||||||
void createMainPlotWindow();
|
void createMainPlotWindow();
|
||||||
void deleteMainPlotWindow();
|
|
||||||
|
|
||||||
void storeTreeViewState();
|
void storeTreeViewState();
|
||||||
|
|
||||||
@ -168,8 +166,8 @@ private slots:
|
|||||||
void onLastWindowClosed();
|
void onLastWindowClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<RiuMainWindow> m_mainWindow;
|
std::unique_ptr<RiuMainWindow> m_mainWindow;
|
||||||
QPointer<RiuPlotMainWindow> m_mainPlotWindow;
|
std::unique_ptr<RiuPlotMainWindow> m_mainPlotWindow;
|
||||||
|
|
||||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ const QString reportFileName = "ResInsightRegressionTestReport.html";
|
|||||||
const QString commandFileFilter = "commandfile-*";
|
const QString commandFileFilter = "commandfile-*";
|
||||||
}; // namespace RegTestNames
|
}; // namespace RegTestNames
|
||||||
|
|
||||||
|
RiaRegressionTestRunner* RiaRegressionTestRunner::sm_singleton = nullptr;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -95,8 +97,25 @@ RiaRegressionTestRunner::RiaRegressionTestRunner()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaRegressionTestRunner* RiaRegressionTestRunner::instance()
|
RiaRegressionTestRunner* RiaRegressionTestRunner::instance()
|
||||||
{
|
{
|
||||||
static RiaRegressionTestRunner* singleton = new RiaRegressionTestRunner;
|
CAF_ASSERT( sm_singleton );
|
||||||
return singleton;
|
return sm_singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaRegressionTestRunner::createSingleton()
|
||||||
|
{
|
||||||
|
if ( !sm_singleton ) sm_singleton = new RiaRegressionTestRunner;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaRegressionTestRunner::deleteSingleton()
|
||||||
|
{
|
||||||
|
if ( sm_singleton ) delete sm_singleton;
|
||||||
|
sm_singleton = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -34,6 +34,9 @@ class RiaRegressionTestRunner
|
|||||||
public:
|
public:
|
||||||
static RiaRegressionTestRunner* instance();
|
static RiaRegressionTestRunner* instance();
|
||||||
|
|
||||||
|
static void createSingleton();
|
||||||
|
static void deleteSingleton();
|
||||||
|
|
||||||
void executeRegressionTests( const QString& regressionTestPath, const QStringList& testFilter );
|
void executeRegressionTests( const QString& regressionTestPath, const QStringList& testFilter );
|
||||||
void executeRegressionTests();
|
void executeRegressionTests();
|
||||||
|
|
||||||
@ -73,4 +76,6 @@ private:
|
|||||||
bool m_appendAllTestsAfterLastItemInFilter;
|
bool m_appendAllTestsAfterLastItemInFilter;
|
||||||
bool m_runningRegressionTests;
|
bool m_runningRegressionTests;
|
||||||
RiaRegressionTest m_regressionTestSettings;
|
RiaRegressionTest m_regressionTestSettings;
|
||||||
|
|
||||||
|
static RiaRegressionTestRunner* sm_singleton;
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( true );
|
||||||
dialog->setCalculationAndUpdateUi( calculation );
|
dialog->setCalculationAndUpdateUi( calculation );
|
||||||
dialog->show();
|
dialog->show();
|
||||||
dialog->raise();
|
dialog->raise();
|
||||||
|
@ -50,7 +50,7 @@ RicEditSummaryPlotFeature::RicEditSummaryPlotFeature()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
|
void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
|
||||||
{
|
{
|
||||||
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
|
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( false );
|
||||||
|
|
||||||
if ( dialog )
|
if ( dialog )
|
||||||
{
|
{
|
||||||
@ -65,13 +65,13 @@ void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog()
|
RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog( bool createIfNotPresent )
|
||||||
{
|
{
|
||||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||||
|
|
||||||
if ( mainPlotWindow )
|
if ( mainPlotWindow )
|
||||||
{
|
{
|
||||||
return mainPlotWindow->summaryCurveCreatorDialog();
|
return mainPlotWindow->summaryCurveCreatorDialog( createIfNotPresent );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -82,7 +82,7 @@ RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicEditSummaryPlotFeature::editSummaryPlot( RimSummaryPlot* plot )
|
void RicEditSummaryPlotFeature::editSummaryPlot( RimSummaryPlot* plot )
|
||||||
{
|
{
|
||||||
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
|
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true );
|
||||||
|
|
||||||
if ( !dialog->isVisible() )
|
if ( !dialog->isVisible() )
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ class RicEditSummaryPlotFeature : public caf::CmdFeature
|
|||||||
public:
|
public:
|
||||||
void closeDialogAndResetTargetPlot();
|
void closeDialogAndResetTargetPlot();
|
||||||
|
|
||||||
static RicSummaryPlotEditorDialog* curveCreatorDialog();
|
static RicSummaryPlotEditorDialog* curveCreatorDialog( bool createIfNotPresent );
|
||||||
static void editSummaryPlot( RimSummaryPlot* plot );
|
static void editSummaryPlot( RimSummaryPlot* plot );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -123,7 +123,7 @@ void RicNewSummaryPlotFeature::onActionTriggered( bool isChecked )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
|
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true );
|
||||||
|
|
||||||
if ( !dialog->isVisible() )
|
if ( !dialog->isVisible() )
|
||||||
{
|
{
|
||||||
|
@ -34,13 +34,13 @@ CAF_CMD_SOURCE_INIT( RicShowSummaryCurveCalculatorFeature, "RicShowSummaryCurveC
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog()
|
RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( bool createIfNotPresent )
|
||||||
{
|
{
|
||||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||||
|
|
||||||
if ( mainPlotWindow )
|
if ( mainPlotWindow )
|
||||||
{
|
{
|
||||||
return mainPlotWindow->summaryCurveCalculatorDialog();
|
return mainPlotWindow->summaryCurveCalculatorDialog( createIfNotPresent );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -51,9 +51,8 @@ RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalc
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicShowSummaryCurveCalculatorFeature::hideCurveCalculatorDialog()
|
void RicShowSummaryCurveCalculatorFeature::hideCurveCalculatorDialog()
|
||||||
{
|
{
|
||||||
auto dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
auto dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( false );
|
||||||
|
if ( dialog ) dialog->hide();
|
||||||
dialog->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -74,7 +73,7 @@ bool RicShowSummaryCurveCalculatorFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicShowSummaryCurveCalculatorFeature::onActionTriggered( bool isChecked )
|
void RicShowSummaryCurveCalculatorFeature::onActionTriggered( bool isChecked )
|
||||||
{
|
{
|
||||||
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( true );
|
||||||
|
|
||||||
RimProject* proj = RimProject::current();
|
RimProject* proj = RimProject::current();
|
||||||
RimSummaryCalculationCollection* calcColl = proj->calculationCollection();
|
RimSummaryCalculationCollection* calcColl = proj->calculationCollection();
|
||||||
|
@ -30,7 +30,7 @@ class RicShowSummaryCurveCalculatorFeature : public caf::CmdFeature
|
|||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static RicSummaryCurveCalculatorDialog* curveCalculatorDialog();
|
static RicSummaryCurveCalculatorDialog* curveCalculatorDialog( bool createIfNotPresent );
|
||||||
static void hideCurveCalculatorDialog();
|
static void hideCurveCalculatorDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -55,6 +55,7 @@ RicSummaryPlotEditorDialog::RicSummaryPlotEditorDialog( QWidget* parent )
|
|||||||
RicSummaryPlotEditorDialog::~RicSummaryPlotEditorDialog()
|
RicSummaryPlotEditorDialog::~RicSummaryPlotEditorDialog()
|
||||||
{
|
{
|
||||||
m_curveCreatorSplitterUi->setPdmObject( nullptr );
|
m_curveCreatorSplitterUi->setPdmObject( nullptr );
|
||||||
|
delete m_curveCreatorSplitterUi;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -119,7 +119,7 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
, m_windowMenu( nullptr )
|
, m_windowMenu( nullptr )
|
||||||
, m_holoLensToolBar( nullptr )
|
, m_holoLensToolBar( nullptr )
|
||||||
{
|
{
|
||||||
m_mdiArea = new RiuMdiArea;
|
m_mdiArea = new RiuMdiArea( this );
|
||||||
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
||||||
setCentralWidget( m_mdiArea );
|
setCentralWidget( m_mdiArea );
|
||||||
|
|
||||||
|
@ -73,6 +73,19 @@ RiuMainWindowBase::RiuMainWindowBase()
|
|||||||
connect( m_redoAction, SIGNAL( triggered() ), SLOT( slotRedo() ) );
|
connect( m_redoAction, SIGNAL( triggered() ), SLOT( slotRedo() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMainWindowBase::~RiuMainWindowBase()
|
||||||
|
{
|
||||||
|
for ( auto v : m_projectTreeViews )
|
||||||
|
{
|
||||||
|
delete v;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_projectTreeViews.clear();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -47,7 +47,8 @@ class RiuMainWindowBase : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RiuMainWindowBase();
|
RiuMainWindowBase();
|
||||||
|
~RiuMainWindowBase();
|
||||||
|
|
||||||
virtual QString mainWindowName() = 0;
|
virtual QString mainWindowName() = 0;
|
||||||
|
|
||||||
|
@ -20,6 +20,22 @@
|
|||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
#include "RiuMdiSubWindow.h"
|
#include "RiuMdiSubWindow.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMdiArea::RiuMdiArea( QWidget* parent /*= nullptr*/ )
|
||||||
|
: QMdiArea( parent )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMdiArea::~RiuMdiArea()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,6 +29,9 @@ class RiuMdiArea : public QMdiArea
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
RiuMdiArea( QWidget* parent = nullptr );
|
||||||
|
~RiuMdiArea();
|
||||||
|
|
||||||
std::list<QMdiSubWindow*> subWindowListSortedByPosition();
|
std::list<QMdiSubWindow*> subWindowListSortedByPosition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -77,7 +77,7 @@ RiuPlotMainWindow::RiuPlotMainWindow()
|
|||||||
: m_activePlotViewWindow( nullptr )
|
: m_activePlotViewWindow( nullptr )
|
||||||
, m_windowMenu( nullptr )
|
, m_windowMenu( nullptr )
|
||||||
{
|
{
|
||||||
m_mdiArea = new RiuMdiArea;
|
m_mdiArea = new RiuMdiArea( this );
|
||||||
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
||||||
setCentralWidget( m_mdiArea );
|
setCentralWidget( m_mdiArea );
|
||||||
|
|
||||||
@ -417,13 +417,13 @@ void RiuPlotMainWindow::createToolBars()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wellLogPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Well Log Plot", this );
|
m_wellLogPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Well Log Plot", this );
|
||||||
m_wellLogPlotToolBarEditor->hide();
|
m_wellLogPlotToolBarEditor->hide();
|
||||||
|
|
||||||
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Summary Plot", this );
|
m_summaryPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Summary Plot", this );
|
||||||
m_summaryPlotToolBarEditor->hide();
|
m_summaryPlotToolBarEditor->hide();
|
||||||
|
|
||||||
m_multiPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Multi Plot", this );
|
m_multiPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Multi Plot", this );
|
||||||
m_multiPlotToolBarEditor->hide();
|
m_multiPlotToolBarEditor->hide();
|
||||||
|
|
||||||
if ( RiaPreferences::current()->useUndoRedo() )
|
if ( RiaPreferences::current()->useUndoRedo() )
|
||||||
@ -516,8 +516,8 @@ void RiuPlotMainWindow::createDockPanels()
|
|||||||
dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowPropertyEditorName() );
|
dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowPropertyEditorName() );
|
||||||
dockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
dockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
||||||
|
|
||||||
m_pdmUiPropertyView = new caf::PdmUiPropertyView( dockWidget );
|
m_pdmUiPropertyView = std::make_unique<caf::PdmUiPropertyView>( dockWidget );
|
||||||
dockWidget->setWidget( m_pdmUiPropertyView );
|
dockWidget->setWidget( m_pdmUiPropertyView.get() );
|
||||||
|
|
||||||
addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
|
addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
|
||||||
}
|
}
|
||||||
@ -535,14 +535,14 @@ void RiuPlotMainWindow::createDockPanels()
|
|||||||
QDockWidget* dockWidget = new QDockWidget( "Plot Manager", this );
|
QDockWidget* dockWidget = new QDockWidget( "Plot Manager", this );
|
||||||
dockWidget->setObjectName( RiuDockWidgetTools::summaryPlotManagerName() );
|
dockWidget->setObjectName( RiuDockWidgetTools::summaryPlotManagerName() );
|
||||||
|
|
||||||
m_summaryPlotManagerView = new caf::PdmUiPropertyView( dockWidget );
|
m_summaryPlotManagerView = std::make_unique<caf::PdmUiPropertyView>( dockWidget );
|
||||||
|
|
||||||
auto plotManager = std::make_unique<RimSummaryPlotManager>();
|
auto plotManager = std::make_unique<RimSummaryPlotManager>();
|
||||||
m_summaryPlotManagerView->showProperties( plotManager.get() );
|
m_summaryPlotManagerView->showProperties( plotManager.get() );
|
||||||
m_summaryPlotManagerView->installEventFilter( plotManager.get() );
|
m_summaryPlotManagerView->installEventFilter( plotManager.get() );
|
||||||
m_summaryPlotManager = std::move( plotManager );
|
m_summaryPlotManager = std::move( plotManager );
|
||||||
|
|
||||||
dockWidget->setWidget( m_summaryPlotManagerView );
|
dockWidget->setWidget( m_summaryPlotManagerView.get() );
|
||||||
addDockWidget( Qt::BottomDockWidgetArea, dockWidget );
|
addDockWidget( Qt::BottomDockWidgetArea, dockWidget );
|
||||||
dockWidget->hide();
|
dockWidget->hide();
|
||||||
}
|
}
|
||||||
@ -750,27 +750,27 @@ void RiuPlotMainWindow::setFocusToLineEditInSummaryToolBar()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicSummaryPlotEditorDialog* RiuPlotMainWindow::summaryCurveCreatorDialog()
|
RicSummaryPlotEditorDialog* RiuPlotMainWindow::summaryCurveCreatorDialog( bool createIfNotPresent )
|
||||||
{
|
{
|
||||||
if ( m_summaryCurveCreatorDialog.isNull() )
|
if ( !m_summaryCurveCreatorDialog && createIfNotPresent )
|
||||||
{
|
{
|
||||||
m_summaryCurveCreatorDialog = new RicSummaryPlotEditorDialog( this );
|
m_summaryCurveCreatorDialog = std::make_unique<RicSummaryPlotEditorDialog>( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_summaryCurveCreatorDialog;
|
return m_summaryCurveCreatorDialog.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicSummaryCurveCalculatorDialog* RiuPlotMainWindow::summaryCurveCalculatorDialog()
|
RicSummaryCurveCalculatorDialog* RiuPlotMainWindow::summaryCurveCalculatorDialog( bool createIfNotPresent )
|
||||||
{
|
{
|
||||||
if ( m_summaryCurveCalculatorDialog.isNull() )
|
if ( !m_summaryCurveCalculatorDialog && createIfNotPresent )
|
||||||
{
|
{
|
||||||
m_summaryCurveCalculatorDialog = new RicSummaryCurveCalculatorDialog( this );
|
m_summaryCurveCalculatorDialog = std::make_unique<RicSummaryCurveCalculatorDialog>( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_summaryCurveCalculatorDialog;
|
return m_summaryCurveCalculatorDialog.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -88,8 +88,8 @@ public:
|
|||||||
void updateSummaryPlotToolBar( bool forceUpdateUi = false );
|
void updateSummaryPlotToolBar( bool forceUpdateUi = false );
|
||||||
void setFocusToLineEditInSummaryToolBar();
|
void setFocusToLineEditInSummaryToolBar();
|
||||||
|
|
||||||
RicSummaryPlotEditorDialog* summaryCurveCreatorDialog();
|
RicSummaryPlotEditorDialog* summaryCurveCreatorDialog( bool createIfNotPresent );
|
||||||
RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog();
|
RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog( bool createIfNotPresent );
|
||||||
|
|
||||||
RiuMessagePanel* messagePanel();
|
RiuMessagePanel* messagePanel();
|
||||||
|
|
||||||
@ -132,16 +132,16 @@ private:
|
|||||||
|
|
||||||
QMenu* m_windowMenu;
|
QMenu* m_windowMenu;
|
||||||
|
|
||||||
caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor;
|
std::unique_ptr<caf::PdmUiToolBarEditor> m_wellLogPlotToolBarEditor;
|
||||||
caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor;
|
std::unique_ptr<caf::PdmUiToolBarEditor> m_multiPlotToolBarEditor;
|
||||||
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
|
std::unique_ptr<caf::PdmUiToolBarEditor> m_summaryPlotToolBarEditor;
|
||||||
|
|
||||||
caf::PdmUiPropertyView* m_pdmUiPropertyView;
|
std::unique_ptr<caf::PdmUiPropertyView> m_pdmUiPropertyView;
|
||||||
caf::PdmUiPropertyView* m_summaryPlotManagerView;
|
std::unique_ptr<caf::PdmUiPropertyView> m_summaryPlotManagerView;
|
||||||
|
|
||||||
QPointer<RicSummaryPlotEditorDialog> m_summaryCurveCreatorDialog;
|
std::unique_ptr<RicSummaryPlotEditorDialog> m_summaryCurveCreatorDialog;
|
||||||
QPointer<RicSummaryCurveCalculatorDialog> m_summaryCurveCalculatorDialog;
|
std::unique_ptr<RicSummaryCurveCalculatorDialog> m_summaryCurveCalculatorDialog;
|
||||||
std::unique_ptr<caf::PdmObject> m_summaryPlotManager;
|
std::unique_ptr<caf::PdmObject> m_summaryPlotManager;
|
||||||
|
|
||||||
std::vector<QWidget*> m_temporaryWidgets;
|
std::vector<QWidget*> m_temporaryWidgets;
|
||||||
};
|
};
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~SummaryIdentifierAndField() { delete m_pdmField; }
|
virtual ~SummaryIdentifierAndField();
|
||||||
|
|
||||||
RifEclipseSummaryAddress::SummaryIdentifierType summaryIdentifier() const { return m_summaryIdentifier; }
|
RifEclipseSummaryAddress::SummaryIdentifierType summaryIdentifier() const { return m_summaryIdentifier; }
|
||||||
caf::PdmField<std::vector<QString>>* pdmField() { return m_pdmField; }
|
caf::PdmField<std::vector<QString>>* pdmField() { return m_pdmField; }
|
||||||
@ -81,6 +81,14 @@ private:
|
|||||||
caf::PdmField<std::vector<QString>>* m_pdmField;
|
caf::PdmField<std::vector<QString>>* m_pdmField;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
SummaryIdentifierAndField::~SummaryIdentifierAndField()
|
||||||
|
{
|
||||||
|
delete m_pdmField;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -303,7 +311,7 @@ RiuSummaryVectorSelectionUi::~RiuSummaryVectorSelectionUi()
|
|||||||
{
|
{
|
||||||
for ( const auto& identifierAndField : identifierAndFieldList.second )
|
for ( const auto& identifierAndField : identifierAndFieldList.second )
|
||||||
{
|
{
|
||||||
delete identifierAndField->pdmField();
|
delete identifierAndField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
typedef Factory<CmdFeature, std::string> CommandFeatureFactory;
|
typedef Factory<CmdFeature, std::string> CommandFeatureFactory;
|
||||||
|
|
||||||
|
CmdFeatureManager* CmdFeatureManager::sm_singleton = nullptr;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -67,6 +70,18 @@ CmdFeatureManager::CmdFeatureManager()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
CmdFeatureManager::~CmdFeatureManager()
|
CmdFeatureManager::~CmdFeatureManager()
|
||||||
{
|
{
|
||||||
|
releaseAllCommandFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void CmdFeatureManager::createSingleton()
|
||||||
|
{
|
||||||
|
if ( !sm_singleton )
|
||||||
|
{
|
||||||
|
sm_singleton = new CmdFeatureManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -74,8 +89,8 @@ CmdFeatureManager::~CmdFeatureManager()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
CmdFeatureManager* CmdFeatureManager::instance()
|
CmdFeatureManager* CmdFeatureManager::instance()
|
||||||
{
|
{
|
||||||
static CmdFeatureManager* singleton = new CmdFeatureManager;
|
CAF_ASSERT( sm_singleton );
|
||||||
return singleton;
|
return sm_singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -345,4 +360,25 @@ QWidget* CmdFeatureManager::currentContextMenuTargetWidget()
|
|||||||
return m_currentContextMenuTargetWidget;
|
return m_currentContextMenuTargetWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void CmdFeatureManager::releaseAllCommandFeatures()
|
||||||
|
{
|
||||||
|
for ( auto c : m_commandFeatures )
|
||||||
|
{
|
||||||
|
if ( c ) delete c;
|
||||||
|
c = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void CmdFeatureManager::deleteSingleton()
|
||||||
|
{
|
||||||
|
if ( sm_singleton ) delete sm_singleton;
|
||||||
|
sm_singleton = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
@ -63,6 +63,9 @@ public:
|
|||||||
static CmdFeatureManager* instance();
|
static CmdFeatureManager* instance();
|
||||||
~CmdFeatureManager() override;
|
~CmdFeatureManager() override;
|
||||||
|
|
||||||
|
static void createSingleton();
|
||||||
|
static void deleteSingleton();
|
||||||
|
|
||||||
QAction* action( const QString& commandId );
|
QAction* action( const QString& commandId );
|
||||||
QAction* action( const QString& commandId, const QString& customActionText );
|
QAction* action( const QString& commandId, const QString& customActionText );
|
||||||
QAction* actionWithUserData( const QString& commandId, const QString& customActionText, const QVariant& userData );
|
QAction* actionWithUserData( const QString& commandId, const QString& customActionText, const QVariant& userData );
|
||||||
@ -86,7 +89,11 @@ private:
|
|||||||
|
|
||||||
CmdFeature* commandFeature( const std::string& commandId ) const;
|
CmdFeature* commandFeature( const std::string& commandId ) const;
|
||||||
|
|
||||||
|
void releaseAllCommandFeatures();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static CmdFeatureManager* sm_singleton;
|
||||||
|
|
||||||
std::vector<CmdFeature*> m_commandFeatures;
|
std::vector<CmdFeature*> m_commandFeatures;
|
||||||
std::map<std::string, size_t> m_commandIdToFeatureIdxMap;
|
std::map<std::string, size_t> m_commandIdToFeatureIdxMap;
|
||||||
std::map<QAction*, size_t> m_actionToFeatureIdxMap;
|
std::map<QAction*, size_t> m_actionToFeatureIdxMap;
|
||||||
|
@ -152,6 +152,15 @@ public:
|
|||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deleteCreatorObjects()
|
||||||
|
{
|
||||||
|
for ( auto f : m_factoryMap )
|
||||||
|
{
|
||||||
|
if ( f.second ) delete f.second;
|
||||||
|
}
|
||||||
|
m_factoryMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Factory() {}
|
Factory() {}
|
||||||
~Factory()
|
~Factory()
|
||||||
|
@ -1,11 +1,63 @@
|
|||||||
#include "cafPdmDefaultObjectFactory.h"
|
#include "cafPdmDefaultObjectFactory.h"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// PdmObjectFactory implementations
|
/// PdmObjectFactory implementations
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PdmDefaultObjectFactory* PdmDefaultObjectFactory::sm_singleton = nullptr;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmDefaultObjectFactory::~PdmDefaultObjectFactory()
|
||||||
|
{
|
||||||
|
// Each keyword alias is connected to the one creator object, so it is not possible to traverse the map directly and
|
||||||
|
// delete the creator objects. Create a set of unique creator objects.
|
||||||
|
std::set<PdmObjectCreatorBase*> uniqueObjects;
|
||||||
|
|
||||||
|
for ( const auto& f : m_factoryMap )
|
||||||
|
{
|
||||||
|
uniqueObjects.insert( f.second );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto obj : uniqueObjects )
|
||||||
|
{
|
||||||
|
if ( obj ) delete obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_factoryMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmDefaultObjectFactory* PdmDefaultObjectFactory::instance()
|
||||||
|
{
|
||||||
|
createSingleton();
|
||||||
|
return sm_singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmDefaultObjectFactory::createSingleton()
|
||||||
|
{
|
||||||
|
if ( !sm_singleton ) sm_singleton = new PdmDefaultObjectFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmDefaultObjectFactory::deleteSingleton()
|
||||||
|
{
|
||||||
|
if ( sm_singleton ) delete sm_singleton;
|
||||||
|
sm_singleton = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -17,10 +69,8 @@ PdmObjectHandle* PdmDefaultObjectFactory::create( const QString& classNameKeywor
|
|||||||
{
|
{
|
||||||
return entryIt->second->create();
|
return entryIt->second->create();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -38,13 +88,4 @@ std::vector<QString> PdmDefaultObjectFactory::classKeywords() const
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
PdmDefaultObjectFactory* PdmDefaultObjectFactory::instance()
|
|
||||||
{
|
|
||||||
static PdmDefaultObjectFactory* fact = new PdmDefaultObjectFactory;
|
|
||||||
return fact;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace caf
|
} // End of namespace caf
|
||||||
|
@ -58,46 +58,28 @@ class PdmDefaultObjectFactory : public PdmObjectFactory
|
|||||||
public:
|
public:
|
||||||
static PdmDefaultObjectFactory* instance();
|
static PdmDefaultObjectFactory* instance();
|
||||||
|
|
||||||
|
static void createSingleton();
|
||||||
|
static void deleteSingleton();
|
||||||
|
|
||||||
PdmObjectHandle* create( const QString& classNameKeyword ) override;
|
PdmObjectHandle* create( const QString& classNameKeyword ) override;
|
||||||
|
|
||||||
template <typename PdmObjectBaseDerivative>
|
template <typename PdmObjectBaseDerivative>
|
||||||
bool registerCreator()
|
bool registerCreator();
|
||||||
{
|
|
||||||
std::vector<QString> classNameKeywords = PdmObjectBaseDerivative::classKeywordAliases();
|
|
||||||
|
|
||||||
for ( QString classNameKeyword : classNameKeywords )
|
|
||||||
{
|
|
||||||
auto entryIt = m_factoryMap.find( classNameKeyword );
|
|
||||||
if ( entryIt != m_factoryMap.end() )
|
|
||||||
{
|
|
||||||
CAF_ASSERT( classNameKeyword != entryIt->first ); // classNameKeyword has already been used
|
|
||||||
CAF_ASSERT( false ); // To be sure ..
|
|
||||||
return false; // never hit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto object = new PdmObjectCreator<PdmObjectBaseDerivative>();
|
|
||||||
for ( QString classNameKeyword : classNameKeywords )
|
|
||||||
{
|
|
||||||
m_factoryMap[classNameKeyword] = object;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<QString> classKeywords() const override;
|
std::vector<QString> classKeywords() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PdmDefaultObjectFactory() {}
|
~PdmDefaultObjectFactory() override;
|
||||||
~PdmDefaultObjectFactory() override
|
|
||||||
{ /* Could clean up, but ... */
|
static PdmDefaultObjectFactory* sm_singleton;
|
||||||
}
|
|
||||||
|
|
||||||
// Internal helper classes
|
// Internal helper classes
|
||||||
|
|
||||||
class PdmObjectCreatorBase
|
class PdmObjectCreatorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PdmObjectCreatorBase() {}
|
PdmObjectCreatorBase() = default;
|
||||||
virtual ~PdmObjectCreatorBase() {}
|
virtual ~PdmObjectCreatorBase() = default;
|
||||||
virtual PdmObjectHandle* create() = 0;
|
virtual PdmObjectHandle* create() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,4 +94,30 @@ private:
|
|||||||
std::map<QString, PdmObjectCreatorBase*> m_factoryMap;
|
std::map<QString, PdmObjectCreatorBase*> m_factoryMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <typename PdmObjectBaseDerivative>
|
||||||
|
bool caf::PdmDefaultObjectFactory::registerCreator()
|
||||||
|
{
|
||||||
|
std::vector<QString> classNameKeywords = PdmObjectBaseDerivative::classKeywordAliases();
|
||||||
|
|
||||||
|
for ( const QString& classNameKeyword : classNameKeywords )
|
||||||
|
{
|
||||||
|
auto entryIt = m_factoryMap.find( classNameKeyword );
|
||||||
|
if ( entryIt != m_factoryMap.end() )
|
||||||
|
{
|
||||||
|
CAF_ASSERT( classNameKeyword != entryIt->first ); // classNameKeyword has already been used
|
||||||
|
CAF_ASSERT( false ); // To be sure ..
|
||||||
|
return false; // never hit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto object = new PdmObjectCreator<PdmObjectBaseDerivative>();
|
||||||
|
for ( const QString& classNameKeyword : classNameKeywords )
|
||||||
|
{
|
||||||
|
m_factoryMap[classNameKeyword] = object;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace caf
|
} // End of namespace caf
|
||||||
|
@ -1,16 +1,38 @@
|
|||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
|
#include "cafPdmDefaultObjectFactory.h"
|
||||||
|
|
||||||
|
#include "cafFactory.h"
|
||||||
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
auto appExitCode = 0;
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
window.setWindowTitle("Ceetron Application Framework Test Application");
|
window.setWindowTitle("Ceetron Application Framework Test Application");
|
||||||
window.resize(1000, 810);
|
window.resize(1000, 810);
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
return app.exec();
|
appExitCode = app.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::CmdFeatureManager::deleteSingleton();
|
||||||
|
caf::PdmDefaultObjectFactory::deleteSingleton();
|
||||||
|
|
||||||
|
{
|
||||||
|
auto factory = caf::Factory<caf::PdmUiFieldEditorHandle, QString>::instance();
|
||||||
|
factory->deleteCreatorObjects();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto factory = caf::Factory<caf::CmdFeature, std::string>::instance();
|
||||||
|
factory->deleteCreatorObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
return appExitCode;
|
||||||
}
|
}
|
||||||
|
@ -1299,6 +1299,8 @@ MainWindow::~MainWindow()
|
|||||||
m_pdmUiPropertyView->showProperties(nullptr);
|
m_pdmUiPropertyView->showProperties(nullptr);
|
||||||
m_pdmUiTableView->setChildArrayField(nullptr);
|
m_pdmUiTableView->setChildArrayField(nullptr);
|
||||||
|
|
||||||
|
releaseTestData();
|
||||||
|
|
||||||
delete m_pdmUiTreeView;
|
delete m_pdmUiTreeView;
|
||||||
delete m_pdmUiTreeView2;
|
delete m_pdmUiTreeView2;
|
||||||
delete m_pdmUiPropertyView;
|
delete m_pdmUiPropertyView;
|
||||||
|
@ -160,6 +160,12 @@ PdmUiTreeViewEditor::~PdmUiTreeViewEditor()
|
|||||||
{
|
{
|
||||||
m_treeView->removeEventFilter( this );
|
m_treeView->removeEventFilter( this );
|
||||||
m_treeViewModel->setPdmItemRoot( nullptr );
|
m_treeViewModel->setPdmItemRoot( nullptr );
|
||||||
|
|
||||||
|
if ( m_mainWidget ) delete m_mainWidget;
|
||||||
|
if ( m_delegate ) delete m_delegate;
|
||||||
|
if ( m_treeViewModel ) delete m_treeViewModel;
|
||||||
|
if ( m_filterModel ) delete m_filterModel;
|
||||||
|
if ( m_treeView ) delete m_treeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -160,10 +160,10 @@ private:
|
|||||||
QPointer<QWidget> m_mainWidget;
|
QPointer<QWidget> m_mainWidget;
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
|
|
||||||
PdmUiTreeViewWidget* m_treeView;
|
QPointer<PdmUiTreeViewWidget> m_treeView;
|
||||||
PdmUiTreeViewQModel* m_treeViewModel;
|
QPointer<PdmUiTreeViewQModel> m_treeViewModel;
|
||||||
PdmUiTreeViewItemDelegate* m_delegate;
|
QPointer<PdmUiTreeViewItemDelegate> m_delegate;
|
||||||
QSortFilterProxyModel* m_filterModel;
|
QPointer<QSortFilterProxyModel> m_filterModel;
|
||||||
|
|
||||||
bool m_useDefaultContextMenu;
|
bool m_useDefaultContextMenu;
|
||||||
bool m_updateSelectionManager;
|
bool m_updateSelectionManager;
|
||||||
|
@ -61,6 +61,18 @@ PdmUiTreeViewQModel::PdmUiTreeViewQModel( PdmUiTreeViewEditor* treeViewEditor )
|
|||||||
m_treeViewEditor = treeViewEditor;
|
m_treeViewEditor = treeViewEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
PdmUiTreeViewQModel::~PdmUiTreeViewQModel()
|
||||||
|
{
|
||||||
|
if ( m_dragDropInterface )
|
||||||
|
{
|
||||||
|
delete m_dragDropInterface;
|
||||||
|
m_dragDropInterface = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Will populate the tree with the contents of the Pdm data structure rooted at rootItem.
|
/// Will populate the tree with the contents of the Pdm data structure rooted at rootItem.
|
||||||
/// Will not show the rootItem itself, only the children and downwards
|
/// Will not show the rootItem itself, only the children and downwards
|
||||||
|
@ -60,6 +60,7 @@ class PdmUiTreeViewQModel : public QAbstractItemModel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PdmUiTreeViewQModel( PdmUiTreeViewEditor* treeViewEditor );
|
explicit PdmUiTreeViewQModel( PdmUiTreeViewEditor* treeViewEditor );
|
||||||
|
virtual ~PdmUiTreeViewQModel();
|
||||||
|
|
||||||
void setPdmItemRoot( PdmUiItem* rootItem );
|
void setPdmItemRoot( PdmUiItem* rootItem );
|
||||||
void updateSubTree( PdmUiItem* subTreeRoot );
|
void updateSubTree( PdmUiItem* subTreeRoot );
|
||||||
|
@ -85,6 +85,7 @@ class RiaGrpcServiceCallback : public RiaGrpcCallbackInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RiaGrpcServiceCallback( ServiceT* service );
|
RiaGrpcServiceCallback( ServiceT* service );
|
||||||
|
~RiaGrpcServiceCallback();
|
||||||
|
|
||||||
QString name() const override;
|
QString name() const override;
|
||||||
const RequestT& request() const;
|
const RequestT& request() const;
|
||||||
@ -99,6 +100,14 @@ protected:
|
|||||||
ReplyT m_reply;
|
ReplyT m_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template <typename ServiceT, typename RequestT, typename ReplyT>
|
||||||
|
RiaGrpcServiceCallback<ServiceT, RequestT, ReplyT>::~RiaGrpcServiceCallback()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
// Templated gRPC-callback for non-streaming services
|
// Templated gRPC-callback for non-streaming services
|
||||||
|
@ -74,6 +74,7 @@ private:
|
|||||||
std::unique_ptr<grpc::Server> m_server;
|
std::unique_ptr<grpc::Server> m_server;
|
||||||
std::list<std::shared_ptr<RiaGrpcServiceInterface>> m_services;
|
std::list<std::shared_ptr<RiaGrpcServiceInterface>> m_services;
|
||||||
std::list<RiaGrpcCallbackInterface*> m_unprocessedRequests;
|
std::list<RiaGrpcCallbackInterface*> m_unprocessedRequests;
|
||||||
|
std::list<RiaGrpcCallbackInterface*> m_allocatedCallbakcs;
|
||||||
std::mutex m_requestMutex;
|
std::mutex m_requestMutex;
|
||||||
std::thread m_thread;
|
std::thread m_thread;
|
||||||
};
|
};
|
||||||
@ -217,6 +218,12 @@ void RiaGrpcServerImpl::quit()
|
|||||||
m_server.reset();
|
m_server.reset();
|
||||||
m_completionQueue.reset();
|
m_completionQueue.reset();
|
||||||
|
|
||||||
|
for ( auto c : m_allocatedCallbakcs )
|
||||||
|
{
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
|
m_allocatedCallbakcs.clear();
|
||||||
|
|
||||||
// Finally clear services
|
// Finally clear services
|
||||||
m_services.clear();
|
m_services.clear();
|
||||||
}
|
}
|
||||||
@ -253,6 +260,8 @@ void RiaGrpcServerImpl::process( RiaGrpcCallbackInterface* method )
|
|||||||
if ( method->callState() == RiaGrpcCallbackInterface::CREATE_HANDLER )
|
if ( method->callState() == RiaGrpcCallbackInterface::CREATE_HANDLER )
|
||||||
{
|
{
|
||||||
method->createRequestHandler( m_completionQueue.get() );
|
method->createRequestHandler( m_completionQueue.get() );
|
||||||
|
|
||||||
|
m_allocatedCallbakcs.push_back( method );
|
||||||
}
|
}
|
||||||
else if ( method->callState() == RiaGrpcCallbackInterface::INIT_REQUEST_STARTED )
|
else if ( method->callState() == RiaGrpcCallbackInterface::INIT_REQUEST_STARTED )
|
||||||
{
|
{
|
||||||
@ -269,7 +278,11 @@ void RiaGrpcServerImpl::process( RiaGrpcCallbackInterface* method )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
method->onFinishRequest();
|
method->onFinishRequest();
|
||||||
|
|
||||||
process( method->createNewFromThis() );
|
process( method->createNewFromThis() );
|
||||||
|
|
||||||
|
m_allocatedCallbakcs.remove( method );
|
||||||
|
|
||||||
delete method;
|
delete method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user