prophylactic double dispose audit.

Change-Id: Ia18c0b7a76fb0894efe33afaf69a0079c4583228
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index e222a64..617bbc3 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -203,6 +203,7 @@ void MediaControl::dispose()
{
    maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL );
    delete mpZoomListBox;
    mpZoomListBox = NULL;
    maTimeEdit.disposeAndClear();
    maZoomToolBox.disposeAndClear();
    maVolumeSlider.disposeAndClear();
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 2042858..b2716ee 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -201,8 +201,11 @@ void MediaWindowImpl::dispose()
    mpMediaWindow = NULL;

    delete mpEmptyBmpEx;
    mpEmptyBmpEx = NULL;
    delete mpAudioBmpEx;
    mpAudioBmpEx = NULL;
    delete mpMediaWindowControl;
    mpMediaWindowControl = NULL;
    Control::dispose();
}

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index be6895c..4afce39 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1683,7 +1683,8 @@ void WatchWindow::dispose()
    aRemoveWatchButton.disposeAndClear();
    aHeaderBar.disposeAndClear();
    aTreeListBox.disposeAndClear();
    GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
    if (!IsDisposed())
        GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
    DockingWindow::dispose();
}

@@ -1928,7 +1929,8 @@ StackWindow::~StackWindow()

void StackWindow::dispose()
{
    GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
    if (!IsDisposed())
        GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
    aTreeListBox.disposeAndClear();
    DockingWindow::dispose();
}
@@ -2177,6 +2179,7 @@ void WatchTreeListBox::dispose()
    while ( pEntry )
    {
        delete static_cast<WatchItem*>(pEntry->GetUserData());
        pEntry->SetUserData(NULL);
        pEntry = Next( pEntry );
    }
    SvHeaderTabListBox::dispose();
@@ -2861,6 +2864,7 @@ CodeCompleteWindow::~CodeCompleteWindow()
void CodeCompleteWindow::dispose()
{
    delete pListBox;
    pListBox = NULL;
    vcl::Window::dispose();
}

diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 642981f8..a85d0e0 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1417,6 +1417,7 @@ void DialogWindowLayout::dispose()
    {
        Remove(pPropertyBrowser);
        delete pPropertyBrowser;
        pPropertyBrowser = 0;
    }
    Layout::dispose();
}
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 8abf230..feb01c0 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -217,7 +217,8 @@ void TreeListBox::dispose()
    SvTreeListEntry* pEntry = First();
    while ( pEntry )
    {
        delete static_cast<Entry*>(pEntry->GetUserData());
        delete static_cast<Entry*>( pEntry->GetUserData() );
        pEntry->SetUserData( NULL );
        pEntry = Next( pEntry );
    }
    SvTreeListBox::dispose();
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 53355ef..31d8bcc 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -118,7 +118,10 @@ MacroChooser::~MacroChooser()
void MacroChooser::dispose()
{
    if ( bForceStoreBasic )
    {
        SfxGetpApp()->SaveBasicAndDialogContainer();
        bForceStoreBasic = false;
    }
    SfxModalDialog::dispose();
}

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 48cd1ed..f7cfbb5 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -167,12 +167,14 @@ CheckBox::~CheckBox()
void CheckBox::dispose()
{
    delete pCheckButton;
    pCheckButton = NULL;

    // delete user data
    SvTreeListEntry* pEntry = First();
    while ( pEntry )
    {
        delete static_cast<LibUserData*>(pEntry->GetUserData());
        delete static_cast<LibUserData*>( pEntry->GetUserData() );
        pEntry->SetUserData( NULL );
        pEntry = Next( pEntry );
    }
    SvTabListBox::dispose();
@@ -487,11 +489,15 @@ LibPage::~LibPage()

void LibPage::dispose()
{
    sal_uInt16 nCount = m_pBasicsBox->GetEntryCount();
    for ( sal_uInt16 i = 0; i < nCount; ++i )
    if (m_pBasicsBox)
    {
        DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i ));
        delete pEntry;
        sal_uInt16 nCount = m_pBasicsBox->GetEntryCount();
        for ( sal_uInt16 i = 0; i < nCount; ++i )
        {
            DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i ));
            delete pEntry;
        }
        m_pBasicsBox = NULL;
    }
    TabPage::dispose();
}
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 9d3185b..216fb1d 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -491,8 +491,13 @@ OrganizeDialog::~OrganizeDialog()

void OrganizeDialog::dispose()
{
    for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
        delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) );
    if (m_pTabCtrl)
    {
        for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
            delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) );
        m_pTabCtrl = NULL;
    }

    TabDialog::dispose();
};

diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
index 14d943f..8c29c63 100644
--- a/basctl/source/basicide/objdlg.cxx
+++ b/basctl/source/basicide/objdlg.cxx
@@ -74,7 +74,8 @@ ObjectCatalog::~ObjectCatalog()

void ObjectCatalog::dispose()
{
    GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
    if (!IsDisposed())
        GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
    aTitle.disposeAndClear();
    aTree.disposeAndClear();
    DockingWindow::dispose();
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
index 9ef9432d..33cf747 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -61,6 +61,7 @@ ChartTypeDialog::~ChartTypeDialog()
void ChartTypeDialog::dispose()
{
    delete m_pChartTypeTabPage;
    m_pChartTypeTabPage = NULL;
    ModalDialog::dispose();
}

diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index e59c95e..88c1a41 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -165,10 +165,15 @@ DataSourceDialog::~DataSourceDialog()
void DataSourceDialog::dispose()
{
    delete m_pRangeChooserTabePage;
    m_pRangeChooserTabePage = NULL;
    delete m_pDataSourceTabPage;

    m_nLastPageId = m_pTabControl->GetCurPageId();
    delete m_pTabControl;
    m_pDataSourceTabPage = NULL;
    if (m_pTabControl)
    {
        m_nLastPageId = m_pTabControl->GetCurPageId();
        delete m_pTabControl;
        m_pTabControl = NULL;
    }
    TabDialog::dispose();
}

diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 25b87fc..0a563e2 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -487,7 +487,9 @@ SchAttribTabDlg::~SchAttribTabDlg()
void SchAttribTabDlg::dispose()
{
    delete m_pSymbolShapeProperties;
    m_pSymbolShapeProperties = NULL;
    delete m_pAutoSymbolGraphic;
    m_pAutoSymbolGraphic = NULL;
    SfxTabDialog::dispose();
}

diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index 6308f587..3769f2e 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -72,8 +72,11 @@ View3DDialog::~View3DDialog()
void View3DDialog::dispose()
{
    delete m_pGeometry;
    m_pGeometry = NULL;
    delete m_pAppearance;
    m_pAppearance = NULL;
    delete m_pIllumination;
    m_pIllumination = NULL;

    m_nLastPageId = m_pTabControl->GetCurPageId();
    TabDialog::dispose();
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index defb3343..2c92a75 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -300,6 +300,7 @@ ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
void ThreeD_SceneIllumination_TabPage::dispose()
{
    delete[] m_pLightSourceInfoList;
    m_pLightSourceInfoList = NULL;
    TabPage::dispose();
}

diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index 85b6570..0cded26 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -78,6 +78,7 @@ SchAxisLabelTabPage::~SchAxisLabelTabPage()
void SchAxisLabelTabPage::dispose()
{
    delete m_pOrientHlp;
    m_pOrientHlp = NULL;
    SfxTabPage::dispose();
}

diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 2b41ab2..c717903 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -780,11 +780,17 @@ void ChartTypeTabPage::dispose()

    //delete all resource helper
    delete m_pDim3DLookResourceGroup;
    m_pDim3DLookResourceGroup = NULL;
    delete m_pStackingResourceGroup;
    m_pStackingResourceGroup = NULL;
    delete m_pSplineResourceGroup;
    m_pSplineResourceGroup = NULL;
    delete m_pGeometryResourceGroup;
    m_pGeometryResourceGroup = NULL;
    delete m_pSortByXValuesResourceGroup;
    m_pSortByXValuesResourceGroup = NULL;
    delete m_pGL3DResourceGroup;
    m_pGL3DResourceGroup = NULL;
    svt::OWizardPage::dispose();
}

diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index c65ef3a..dc8e84c 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -45,6 +45,7 @@ SchLayoutTabPage::~SchLayoutTabPage()
void SchLayoutTabPage::dispose()
{
    delete m_pGeometryResources;
    m_pGeometryResources = NULL;
    SfxTabPage::dispose();
}

diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index 45ee087..a83373d 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -63,6 +63,7 @@ SchAlignmentTabPage::~SchAlignmentTabPage()
void SchAlignmentTabPage::dispose()
{
    delete m_pOrientHlp;
    m_pOrientHlp = NULL;
    SfxTabPage::dispose();
}

diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 8926b94..fafc90a 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -60,7 +60,7 @@ void OPredicateCompiler::dispose()
{
    Clean();
    m_orgColumns        = NULL;
m_xIndexes.clear();
    m_xIndexes.clear();
}

void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index d6a2c53..a65e565 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -828,6 +828,8 @@ void SfxAcceleratorConfigPage::dispose()
    m_pKeyBox->Clear();

    delete m_pFileDlg;
    m_pFileDlg = NULL;

    SfxTabPage::dispose();
}

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 7c108a6..8fc2b26 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2233,9 +2233,13 @@ void SvxMenuConfigPage::dispose()

        delete pData;
    }
    m_pSaveInListBox->Clear();

    delete m_pSelectorDlg;
    m_pSelectorDlg = NULL;
    delete m_pContentsListBox;
    m_pContentsListBox = NULL;

    SvxConfigPage::dispose();
}

@@ -2925,14 +2929,14 @@ void SvxToolbarConfigPage::dispose()

        delete pData;
    }
    m_pSaveInListBox->Clear();

    if ( m_pSelectorDlg != NULL )
    {
        delete m_pSelectorDlg;
    }

    delete m_pSelectorDlg;
    m_pSelectorDlg = NULL;

    delete m_pContentsListBox;
    m_pContentsListBox = NULL;

    SvxConfigPage::dispose();
}

@@ -4531,6 +4535,8 @@ SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
void SvxToolbarEntriesListBox::dispose()
{
    delete m_pButtonData;
    m_pButtonData = NULL;

    SvxMenuEntriesListBox::dispose();
}

@@ -4920,20 +4926,23 @@ SvxIconSelectorDialog::~SvxIconSelectorDialog()

void SvxIconSelectorDialog::dispose()
{
    sal_uInt16 nCount = pTbSymbol->GetItemCount();

    for (sal_uInt16 n = 0; n < nCount; ++n )
    if (pTbSymbol)
    {
        sal_uInt16 nId = pTbSymbol->GetItemId(n);
        sal_uInt16 nCount = pTbSymbol->GetItemCount();

        uno::XInterface* xi = static_cast< uno::XInterface* >(
            pTbSymbol->GetItemData( nId ) );

        if ( xi != NULL )
        for (sal_uInt16 n = 0; n < nCount; ++n )
        {
            sal_uInt16 nId = pTbSymbol->GetItemId(n);

            uno::XInterface* xi = static_cast< uno::XInterface* >(
                pTbSymbol->GetItemData( nId ) );

            if ( xi != NULL )
            xi->release();
        }
        pTbSymbol = NULL;
    }

    ModalDialog::dispose();
}

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 2d130a5..5c81f1c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -251,19 +251,19 @@ SpellDialog::~SpellDialog()

void SpellDialog::dispose()
{
    // save possibly modified user-dictionaries
    Reference< XSearchableDictionaryList >  xDicList( SvxGetDictionaryList() );
    if (xDicList.is())
    if (pImpl)
    {
        SaveDictionaries( xDicList );
    }
        // save possibly modified user-dictionaries
        Reference< XSearchableDictionaryList >  xDicList( SvxGetDictionaryList() );
        if (xDicList.is())
            SaveDictionaries( xDicList );

    delete pImpl;
        delete pImpl;
        pImpl = NULL;
    }
    SfxModelessDialog::dispose();
}



void SpellDialog::Init_Impl()
{
    // initialize handler
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 76619da..7edff10 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -366,6 +366,7 @@ ColorFieldControl::~ColorFieldControl()
void ColorFieldControl::dispose()
{
    delete mpBitmap;
    mpBitmap = NULL;
    Control::dispose();
}

@@ -758,6 +759,7 @@ ColorSliderControl::~ColorSliderControl()
void ColorSliderControl::dispose()
{
    delete mpBitmap;
    mpBitmap = NULL;
    Control::dispose();
}

diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index d651f0e..c8bbf0a 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -170,13 +170,12 @@ void FmSearchDialog::dispose()

    SaveParams();

    if (m_pConfig)
    {
        delete m_pConfig;
        m_pConfig = NULL;
    }
    delete m_pConfig;
    m_pConfig = NULL;

    delete m_pSearchEngine;
    m_pSearchEngine = NULL;

    ModalDialog::dispose();
}

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 27337db..ac330ae 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -767,11 +767,11 @@ void TPGalleryThemeProperties::dispose()
    for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) {
        delete aFilterEntryList[ i ];
    }
    aFilterEntryList.clear();

    SfxTabPage::dispose();
}



SfxTabPage* TPGalleryThemeProperties::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
    return new TPGalleryThemeProperties( pParent, *rSet );
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index bb5463e..99f8dadd 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -167,6 +167,8 @@ void SvxHpLinkDlg::dispose()
    aViewOpt.Delete();

    delete mpItemSet;
    mpItemSet = NULL;

    IconChoiceDialog::dispose();
}

diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 1f6c663..4a49494 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -144,6 +144,7 @@ SvxMessDialog::~SvxMessDialog()
void SvxMessDialog::dispose()
{
    delete pImage;
    pImage = NULL;
    ModalDialog::dispose();
}

diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 46136a9..6d8e101 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -1139,17 +1139,17 @@ namespace svx

    void HangulHanjaOptionsDialog::dispose()
    {
        SvTreeListEntry*    pEntry = m_pDictsLB->First();
        SvTreeListEntry* pEntry = m_pDictsLB->First();
        while( pEntry )
        {
            OUString const * pDel = static_cast<OUString const *>(pEntry->GetUserData());
            if( pDel )
                delete pDel;
            delete static_cast<OUString const *>(pEntry->GetUserData());
            pEntry->SetUserData(NULL);
            pEntry = m_pDictsLB->Next( pEntry );
        }

        if( m_pCheckButtonData )
            delete m_pCheckButtonData;
        delete m_pCheckButtonData;
        m_pCheckButtonData = NULL;

        ModalDialog::dispose();
    }

@@ -1785,8 +1785,8 @@ namespace svx

    void HangulHanjaEditDictDialog::dispose()
    {
        if( m_pSuggestions )
            delete m_pSuggestions;
        delete m_pSuggestions;
        m_pSuggestions = NULL;
        ModalDialog::dispose();
    }

diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index f1c7900..ad1e7fa 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -134,11 +134,11 @@ SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()

void SvxHyperlinkNewDocTp::dispose()
{
    for ( sal_uInt16 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
    if (m_pLbDocTypes)
    {
        DocumentTypeData* pTypeData = static_cast<DocumentTypeData*>(
                                      m_pLbDocTypes->GetEntryData ( n ));
        delete pTypeData;
        for ( sal_uInt16 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
            delete static_cast<DocumentTypeData*>(m_pLbDocTypes->GetEntryData ( n ));
        m_pLbDocTypes = NULL;
    }
    SvxHyperlinkTabPageBase::dispose();
}
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 62fd046..8044423 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -115,6 +115,8 @@ void SvxHyperlinkTabPageBase::dispose()
    maTimer.Stop();

    delete mpMarkWnd;
    mpMarkWnd = NULL;

    IconChoicePage::dispose();
}

diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 111499e..0a1c70e 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -236,18 +236,24 @@ void IconChoiceDialog::dispose()
        }
        delete pData;
    }
    maPageList.clear();

    // remove Userdata from Icons
    for ( sal_uLong i=0; i < m_pIconCtrl->GetEntryCount(); i++)
    if (m_pIconCtrl)
    {
        SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
        sal_uInt16* pUserData = static_cast<sal_uInt16*>(pEntry->GetUserData());
        delete pUserData;
        // remove Userdata from Icons
        for ( sal_uLong i=0; i < m_pIconCtrl->GetEntryCount(); i++)
        {
            SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
            delete static_cast<sal_uInt16*>(pEntry->GetUserData());
        }
        m_pIconCtrl = NULL;
    }


    delete pRanges;
    pRanges = NULL;
    delete pOutSet;
    pOutSet = NULL;

    ModalDialog::dispose();
}

diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index db36044..4131c40 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -401,11 +401,10 @@ SvInsertPlugInDialog::~SvInsertPlugInDialog()
void SvInsertPlugInDialog::dispose()
{
    delete m_pURL;
    m_pURL = NULL;
    InsertObjectDialog_Impl::dispose();
}



static void Plugin_ImplFillCommandSequence( const OUString& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence )
{
    sal_Int32 nEaten;
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 6b4b4b7..ebb8fcd 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -237,6 +237,8 @@ void SvxMultiPathDialog::dispose()
    }

    delete m_pRadioLB;
    m_pRadioLB = NULL;

    ModalDialog::dispose();
}

@@ -247,10 +249,13 @@ SvxPathSelectDialog::~SvxPathSelectDialog()

void SvxPathSelectDialog::dispose()
{
    sal_uInt16 nPos = m_pPathLB->GetEntryCount();
    while ( nPos-- )
        delete static_cast<OUString*>(m_pPathLB->GetEntryData(nPos));

    if (m_pPathLB)
    {
        sal_uInt16 nPos = m_pPathLB->GetEntryCount();
        while ( nPos-- )
            delete static_cast<OUString*>(m_pPathLB->GetEntryData(nPos));
        m_pPathLB = NULL;
    }
    ModalDialog::dispose();
}

diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index da6a1e6..bb797e3 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -70,6 +70,7 @@ SvxSearchFormatDialog::~SvxSearchFormatDialog()
void SvxSearchFormatDialog::dispose()
{
    delete m_pFontList;
    m_pFontList = NULL;
    SfxTabDialog::dispose();
}

diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 0cfb700..8e47763 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -157,6 +157,7 @@ void CertPathDialog::dispose()
        pEntry = m_pCertPathList->Next( pEntry );
    }
    delete m_pCertPathList;
    m_pCertPathList = NULL;
    ModalDialog::dispose();
}

diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index eb2364e..de08fa0 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -171,6 +171,7 @@ void DbRegistrationOptionsPage::dispose()
    for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
        delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() );
    delete pPathBox;
    pPathBox = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index c135ab2..098855a 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -144,8 +144,11 @@ SvxFontSubstTabPage::~SvxFontSubstTabPage()
void SvxFontSubstTabPage::dispose()
{
    delete pCheckButtonData;
    pCheckButtonData = NULL;
    delete pConfig;
    pConfig = NULL;
    delete m_pCheckLB;
    m_pCheckLB = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
index 8deb9e7..f09b19c 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -64,6 +64,7 @@ SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
void SvxAccessibilityOptionsTabPage::dispose()
{
    delete m_pImpl;
    m_pImpl = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index f8658bd..0f9bab2 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -157,6 +157,7 @@ SvxAsianLayoutPage::~SvxAsianLayoutPage()
void SvxAsianLayoutPage::dispose()
{
    delete pImpl;
    pImpl = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 8f8fd97..8005483 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -89,11 +89,16 @@ SvxDefaultColorOptPage::~SvxDefaultColorOptPage()
void SvxDefaultColorOptPage::dispose()
{
    // save changes
    pChartOptions->SetDefaultColors( pColorConfig->GetColorList() );
    pChartOptions->Commit();
    if (pChartOptions)
    {
        pChartOptions->SetDefaultColors( pColorConfig->GetColorList() );
        pChartOptions->Commit();

    delete pColorConfig;
    delete pChartOptions;
        delete pColorConfig;
        pColorConfig = NULL;
        delete pChartOptions;
        pChartOptions = NULL;
    }
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index c96cb62..b18abcc 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -1077,23 +1077,29 @@ SvxColorOptionsTabPage::~SvxColorOptionsTabPage()

void SvxColorOptionsTabPage::dispose()
{
    //when the dialog is cancelled but the color scheme ListBox has been changed these
    //changes need to be undone
    if(!bFillItemSetCalled && m_pColorSchemeLB->IsValueChangedFromSaved())
    if (pColorConfig)
    {
        OUString sOldScheme =  m_pColorSchemeLB->GetEntry(m_pColorSchemeLB->GetSavedValue());
        if(!sOldScheme.isEmpty())
        //when the dialog is cancelled but the color scheme ListBox has been changed these
        //changes need to be undone
        if(!bFillItemSetCalled && m_pColorSchemeLB->IsValueChangedFromSaved())
        {
            pColorConfig->SetCurrentSchemeName(sOldScheme);
            pExtColorConfig->SetCurrentSchemeName(sOldScheme);
            OUString sOldScheme =  m_pColorSchemeLB->GetEntry(m_pColorSchemeLB->GetSavedValue());
            if(!sOldScheme.isEmpty())
            {
                pColorConfig->SetCurrentSchemeName(sOldScheme);
                pExtColorConfig->SetCurrentSchemeName(sOldScheme);
            }
        }
        pColorConfig->ClearModified();
        pColorConfig->EnableBroadcast();
        delete pColorConfig;
        pColorConfig = NULL;

        pExtColorConfig->ClearModified();
        pExtColorConfig->EnableBroadcast();
        delete pExtColorConfig;
        pExtColorConfig = NULL;
    }
    pColorConfig->ClearModified();
    pColorConfig->EnableBroadcast();
    delete pColorConfig;
    pExtColorConfig->ClearModified();
    pExtColorConfig->EnableBroadcast();
    delete pExtColorConfig;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 59262aa..6a6d711 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -165,7 +165,9 @@ OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
void OfaMSFilterTabPage2::dispose()
{
    delete pCheckButtonData;
    pCheckButtonData = NULL;
    delete m_pCheckLB;
    m_pCheckLB = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 09c74e5a..3ab3ae8 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -688,8 +688,11 @@ OfaViewTabPage::~OfaViewTabPage()
void OfaViewTabPage::dispose()
{
    delete mpDrawinglayerOpt;
    mpDrawinglayerOpt = NULL;
    delete pCanvasSettings;
    pCanvasSettings = NULL;
    delete pAppearanceCfg;
    pAppearanceCfg = NULL;
    SfxTabPage::dispose();
}

@@ -1213,6 +1216,7 @@ OfaLanguagesTabPage::~OfaLanguagesTabPage()
void OfaLanguagesTabPage::dispose()
{
    delete pLangConfig;
    pLangConfig = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 04333b7..a9063ece 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -628,9 +628,11 @@ SvxSecurityTabPage::~SvxSecurityTabPage()
void SvxSecurityTabPage::dispose()
{
    delete mpCertPathDlg;

    mpCertPathDlg = NULL;
    delete mpSecOptions;
    mpSecOptions = NULL;
    delete mpSecOptDlg;
    mpSecOptDlg = NULL;
    SfxTabPage::dispose();
}

@@ -980,6 +982,7 @@ SvxEMailTabPage::~SvxEMailTabPage()
void SvxEMailTabPage::dispose()
{
    delete pImpl;
    pImpl = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 8843f10..5be1b1fa 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -208,8 +208,11 @@ SvxJavaOptionsPage::~SvxJavaOptionsPage()
void SvxJavaOptionsPage::dispose()
{
    delete m_pJavaList;
    m_pJavaList = NULL;
    delete m_pParamDlg;
    m_pParamDlg = NULL;
    delete m_pPathDlg;
    m_pPathDlg = NULL;
    ClearJavaInfo();
#if HAVE_FEATURE_JAVA
    std::vector< JavaInfo* >::iterator pIter;
@@ -218,6 +221,7 @@ void SvxJavaOptionsPage::dispose()
        JavaInfo* pInfo = *pIter;
        jfw_freeJavaInfo( pInfo );
    }
    m_aAddedInfos.clear();

    jfw_unlock();
#endif
@@ -944,14 +948,16 @@ SvxJavaClassPathDlg::~SvxJavaClassPathDlg()

void SvxJavaClassPathDlg::dispose()
{
    sal_Int32 i, nCount = m_pPathList->GetEntryCount();
    for ( i = 0; i < nCount; ++i )
        delete static_cast< OUString* >( m_pPathList->GetEntryData(i) );
    if (m_pPathList)
    {
        sal_Int32 i, nCount = m_pPathList->GetEntryCount();
        for ( i = 0; i < nCount; ++i )
            delete static_cast< OUString* >( m_pPathList->GetEntryData(i) );
        m_pPathList = NULL;
    }
    ModalDialog::dispose();
}



IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl)
{
    sfx2::FileDialogHelper aDlg( TemplateDescription::FILEOPEN_SIMPLE, 0 );
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 393f6f7..8e7929e 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1127,8 +1127,8 @@ SvxLinguTabPage::~SvxLinguTabPage()

void SvxLinguTabPage::dispose()
{
    if (pLinguData)
        delete pLinguData;
    delete pLinguData;
    pLinguData = NULL;
    SfxTabPage::dispose();
}

@@ -1904,10 +1904,10 @@ SvxEditModulesDlg::~SvxEditModulesDlg()
void SvxEditModulesDlg::dispose()
{
    delete pDefaultLinguData;
    pDefaultLinguData = NULL;
    ModalDialog::dispose();
}


SvTreeListEntry* SvxEditModulesDlg::CreateEntry( OUString& rTxt, sal_uInt16 nCol )
{
    SvTreeListEntry* pEntry = new SvTreeListEntry;
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 8cefe81..94de402 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -252,15 +252,18 @@ SvxPathTabPage::~SvxPathTabPage()

void SvxPathTabPage::dispose()
{
    for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
        delete static_cast<PathUserData_Impl*>(pPathBox->GetEntry(i)->GetUserData());
    delete pPathBox;
    if ( pPathBox )
    {
        for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
            delete static_cast<PathUserData_Impl*>(pPathBox->GetEntry(i)->GetUserData());
        delete pPathBox;
        pPathBox = NULL;
    }
    delete pImpl;
    pImpl = NULL;
    SfxTabPage::dispose();
}



SfxTabPage* SvxPathTabPage::Create( vcl::Window* pParent,
                                    const SfxItemSet* rAttrSet )
{
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 12fac31..00d3aff 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -205,11 +205,10 @@ SfxSaveTabPage::~SfxSaveTabPage()
void SvxSaveTabPage::dispose()
{
    delete pImpl;
    pImpl = NULL;
    SfxTabPage::dispose();
}



SfxTabPage* SfxSaveTabPage::Create( vcl::Window* pParent,
                                    const SfxItemSet* rAttrSet )
{
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 75311ef..095b6fc 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -558,7 +558,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
void OfaTreeOptionsDialog::dispose()
{
    pCurrentPageEntry = NULL;
    SvTreeListEntry* pEntry = pTreeLB->First();
    SvTreeListEntry* pEntry = pTreeLB ? pTreeLB->First() : NULL;
    // first children
    while(pEntry)
    {
@@ -596,7 +596,7 @@ void OfaTreeOptionsDialog::dispose()
    }

    // and parents
    pEntry = pTreeLB->First();
    pEntry = pTreeLB ? pTreeLB->First() : NULL;
    while(pEntry)
    {
        if(!pTreeLB->GetParent(pEntry))
@@ -609,7 +609,9 @@ void OfaTreeOptionsDialog::dispose()
        pEntry = pTreeLB->Next(pEntry);
    }
    delete pColorPageItemSet;
    pColorPageItemSet = NULL;
    deleteGroupNames();
    pTreeLB = NULL;
    SfxModalDialog::dispose();
}

diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 9acfdaf..6628b18 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -148,10 +148,10 @@ WebConnectionInfoDialog::~WebConnectionInfoDialog()
void WebConnectionInfoDialog::dispose()
{
    delete m_pPasswordsLB;
    m_pPasswordsLB = NULL;
    ModalDialog::dispose();
}


IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvSimpleTable*, pTable )
{
    m_pPasswordsLB->Resort( NULL == pTable );
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 1c5587c..7405627 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -256,6 +256,7 @@ AlignmentTabPage::~AlignmentTabPage()
void AlignmentTabPage::dispose()
{
    delete m_pOrientHlp;
    m_pOrientHlp = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index a35fa19..9ad3cfca 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -474,11 +474,16 @@ OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()

void OfaSwAutoFmtOptionsPage::dispose()
{
    delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( REPLACE_BULLETS ));
    delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( APPLY_NUMBERING ));
    delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( MERGE_SINGLE_LINE_PARA ));
    delete pCheckButtonData;
    delete m_pCheckLB;
    if (m_pCheckLB)
    {
        delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( REPLACE_BULLETS ));
        delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( APPLY_NUMBERING ));
        delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( MERGE_SINGLE_LINE_PARA ));
        delete pCheckButtonData;
        pCheckButtonData = NULL;
        delete m_pCheckLB;
        m_pCheckLB = NULL;
    }
    SfxTabPage::dispose();
}

@@ -912,7 +917,9 @@ void OfaAutocorrReplacePage::dispose()
    aChangesTable.clear();

    delete pCompareClass;
    pCompareClass = NULL;
    delete pCharClass;
    pCharClass = NULL;
    SfxTabPage::dispose();
}

@@ -1841,7 +1848,9 @@ OfaQuoteTabPage::~OfaQuoteTabPage()
void OfaQuoteTabPage::dispose()
{
    delete pCheckButtonData;
    pCheckButtonData = NULL;
    delete m_pSwCheckLB;
    m_pSwCheckLB = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 2945304..15c7826 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -237,10 +237,10 @@ BackgroundPreviewImpl::~BackgroundPreviewImpl()
void BackgroundPreviewImpl::dispose()
{
    delete pBitmap;
    pBitmap = NULL;
    vcl::Window::dispose();
}


void BackgroundPreviewImpl::NotifyChange( const Color& rColor )
{
    if ( !bIsBmp )
@@ -434,9 +434,15 @@ SvxBackgroundTabPage::~SvxBackgroundTabPage()

void SvxBackgroundTabPage::dispose()
{
    delete pPageImpl->pLoadIdle;
    delete pPageImpl;
    if (pPageImpl)
    {
        delete pPageImpl->pLoadIdle;
        delete pPageImpl;
        pPageImpl = NULL;
    }

    delete pImportDlg;
    pImportDlg = NULL;

    if( pTableBck_Impl)
    {
@@ -444,6 +450,7 @@ void SvxBackgroundTabPage::dispose()
        delete pTableBck_Impl->pRowBrush;
        delete pTableBck_Impl->pTableBrush;
        delete pTableBck_Impl;
        pTableBck_Impl = NULL;
    }

    if(pParaBck_Impl)
@@ -451,6 +458,7 @@ void SvxBackgroundTabPage::dispose()
        delete pParaBck_Impl->pParaBrush;
        delete pParaBck_Impl->pCharBrush;
        delete pParaBck_Impl;
        pParaBck_Impl = NULL;
    }
    SvxTabPage::dispose();
}
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index d3fc397..f4c1054 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -375,11 +375,10 @@ SvxCharNamePage::~SvxCharNamePage()
void SvxCharNamePage::dispose()
{
    delete m_pImpl;
    m_pImpl = NULL;
    SvxCharBasePage::dispose();
}



void SvxCharNamePage::Initialize()
{
    // to handle the changes of the other pages
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index f80c0d8..cab5ff26 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -289,7 +289,9 @@ SvxNumberFormatTabPage::~SvxNumberFormatTabPage()
void SvxNumberFormatTabPage::dispose()
{
    delete pNumFmtShell;
    pNumFmtShell = NULL;
    delete pNumItem;
    pNumItem = NULL;
    SfxTabPage::dispose();
}

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7ffcd79..56d500e 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -225,7 +225,9 @@ SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
void SvxSingleNumPickTabPage::dispose()
{
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

@@ -392,7 +394,9 @@ SvxBulletPickTabPage::~SvxBulletPickTabPage()
void SvxBulletPickTabPage::dispose()
{
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

@@ -595,7 +599,9 @@ SvxNumPickTabPage::~SvxNumPickTabPage()
void SvxNumPickTabPage::dispose()
{
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

@@ -842,7 +848,9 @@ SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
void SvxBitmapPickTabPage::dispose()
{
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

@@ -1154,9 +1162,15 @@ SvxNumOptionsTabPage::~SvxNumOptionsTabPage()

void SvxNumOptionsTabPage::dispose()
{
    delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
    if (m_pBitmapMB)
    {
        delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
        m_pBitmapMB = NULL;
    }
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

@@ -2719,9 +2733,12 @@ SvxNumPositionTabPage::~SvxNumPositionTabPage()
void SvxNumPositionTabPage::dispose()
{
    delete pActNum;
    pActNum = NULL;
    delete pSaveNum;
    pSaveNum = NULL;
    SfxTabPage::dispose();
}

/*-------------------------------------------------------*/

#if OSL_DEBUG_LEVEL > 1
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 13f87f7..6c8c41e 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -374,6 +374,8 @@ void SvxPageDescPage::dispose()
    if(mbDelPrinter)
    {
        delete mpDefPrinter;
        mpDefPrinter = NULL;
        mbDelPrinter = false;
    }
    SfxTabPage::dispose();
}
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 3a81c3d..faf565c 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -128,11 +128,10 @@ SvxBitmapTabPage::~SvxBitmapTabPage()
void SvxBitmapTabPage::dispose()
{
    delete m_pBitmapCtl;
    m_pBitmapCtl = NULL;
    SvxTabPage::dispose();
}



void SvxBitmapTabPage::Construct()
{
    m_pLbColor->Fill( pColorList );
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index a9dd014..3d74649 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -403,11 +403,10 @@ SvxColorTabPage::~SvxColorTabPage()
void SvxColorTabPage::dispose()
{
    delete pShadow;
    pShadow = NULL;
    SfxTabPage::dispose();
}



void SvxColorTabPage::ImpColorCountChanged()
{
    if (!pColorList.is())
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index eb0cf97..e6fe6a9 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -236,11 +236,14 @@ SvxLineTabPage::~SvxLineTabPage()
void SvxLineTabPage::dispose()
{
    // Symbols on a line (e.g. StarCharts), dtor new!
    if (m_pSymbolMB)
    {
        delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );

    delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );

    if(pSymbolList)
        delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
        if(pSymbolList)
            delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
        m_pSymbolMB = NULL;
    }

    for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i )
    {
@@ -248,6 +251,8 @@ void SvxLineTabPage::dispose()
        delete pInfo->pBrushItem;
        delete pInfo;
    }
    aGrfBrushItems.clear();

    SvxTabPage::dispose();
}

diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx
index 35d84aa..23dfa0f 100644
--- a/fpicker/source/office/PlacesListBox.cxx
+++ b/fpicker/source/office/PlacesListBox.cxx
@@ -94,8 +94,11 @@ PlacesListBox::~PlacesListBox( )
void PlacesListBox::dispose()
{
    delete mpImpl;
    mpImpl = NULL;
    delete mpAddBtn;
    mpAddBtn = NULL;
    delete mpDelBtn;
    mpDelBtn = NULL;
    Control::dispose();
}

diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 0637d7d..e624ad6 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -511,14 +511,13 @@ SfxFloatingWindow::~SfxFloatingWindow()

void SfxFloatingWindow::dispose()
{
    if ( pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
    if ( pImp && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
        pBindings->SetActiveFrame( NULL );
    delete pImp;
    pImp = NULL;
    FloatingWindow::dispose();
}



void SfxFloatingWindow::Resize()

/*  [Description]
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 3a496f0..3d4ac23 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -136,9 +136,13 @@ void SmEditWindow::dispose()
    // must be done before EditView (and thus EditEngine) is no longer
    // available for those classes.
    if (pAccessible)
    {
        pAccessible->ClearWin();    // make Accessible defunctional
        pAccessible = NULL;
        xAccessible.clear();
    }
    // Note: memory for pAccessible will be freed when the reference
    // xAccessible is released.
    // xAccessible is released. FIXME: horribly redundant lifecycle ! ...

    if (pEditView)
    {
@@ -157,6 +161,7 @@ void SmEditWindow::dispose()
    pVScrollBar = NULL;
    delete pScrollBox;
    pScrollBox = NULL;

    vcl::Window::dispose();
}

diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index 01d4994..f396b5c 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -149,9 +149,14 @@ void SmToolBoxWindow::dispose()
    {
        ToolBox *pBox = vToolBoxCategories[i];
        delete pBox;
        vToolBoxCategories[i] = 0;
    }
    pToolBoxCmd = 0;
    for (i = 0;  i < NUM_TBX_CATEGORIES + 1;  ++i)
    {
        delete aImageLists[i];
        aImageLists[i] = 0;
    }
    SfxFloatingWindow::dispose();
}

diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 5b5de37..49fb3aa 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -781,7 +781,6 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId )

void BrowseBox::RemoveColumns()
{

    size_t nOldCount = pCols->size();

    // remove all columns
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index be8b574..87e019d 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -119,17 +119,16 @@ HeaderBar::~HeaderBar()

void HeaderBar::dispose()
{
    // Alle Items loeschen
    for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
        delete (*mpItemList)[ i ];
    if (mpItemList)
    {
        for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
            delete (*mpItemList)[ i ];
        delete mpItemList;
        mpItemList = NULL;
    }
    mpItemList->clear();
    delete mpItemList;
    Window::dispose();
}



void HeaderBar::ImplInitSettings( bool bFont,
                                  bool bForeground, bool bBackground )
{
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 9542c99..f704de3 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -909,6 +909,7 @@ RecoveryDialog::~RecoveryDialog()
void RecoveryDialog::dispose()
{
    delete m_pFileListLB;
    m_pFileListLB = NULL;
    Dialog::dispose();
}

diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 860c6ac..e1ed4af 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -141,7 +141,7 @@ void FmGridHeader::dispose()
{
    delete m_pImpl;
    m_pImpl = NULL;
    FmGridHeader::dispose();
    svt::EditBrowserHeader::dispose();
}

sal_uInt16 FmGridHeader::GetModelColumnPos(sal_uInt16 nId) const
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index a60522a..89caf26 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -956,9 +956,10 @@ DbGridControl::~DbGridControl()

void DbGridControl::dispose()
{
    RemoveColumns();

    if (!IsDisposed())
    {
        RemoveColumns();

        m_bWantDestruction = true;
        osl::MutexGuard aGuard(m_aDestructionSafety);
        if (m_pFieldListeners)
@@ -984,7 +985,9 @@ void DbGridControl::dispose()
    m_xRowSetListener.clear();

    delete m_pDataCursor;
    m_pDataCursor = NULL;
    delete m_pSeekCursor;
    m_pSeekCursor = NULL;

    m_aBar.disposeAndClear();

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 0d2893c..7af4b3b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2262,7 +2262,7 @@ SwViewShell::CreateAccessiblePreview()

void SwViewShell::InvalidateAccessibleFocus()
{
    if( Imp() && Imp()->IsAccessible() )
    if( this && Imp() && Imp()->IsAccessible() )
        Imp()->GetAccessibleMap().InvalidateFocus();
}

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 20a43c0..1e2b292 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5082,7 +5082,7 @@ void SwEditWin::LoseFocus()
{
    m_rView.GetWrtShell().InvalidateAccessibleFocus();
    Window::LoseFocus();
    if( m_pQuickHlpData->m_bIsDisplayed )
    if( m_pQuickHlpData && m_pQuickHlpData->m_bIsDisplayed )
        m_pQuickHlpData->Stop( m_rView.GetWrtShell() );
}

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1fffd48..7861656 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -96,13 +96,11 @@ Button::Button( WindowType nType ) :
Button::~Button()
{
    dispose();
    delete mpButtonData;
}

void Button::dispose()
{
    delete mpButtonData;
    mpButtonData = NULL;

    Control::dispose();
}

@@ -543,7 +541,7 @@ sal_uInt16& Button::ImplGetButtonState()

sal_uInt16 Button::ImplGetButtonState() const
{
    return mpButtonData->mnButtonState;
    return mpButtonData ? mpButtonData->mnButtonState : 0;
}

void Button::ImplSetSymbolAlign( SymbolAlign eAlign )
@@ -1588,7 +1586,8 @@ void PushButton::SetPressed( bool bPressed )
void PushButton::EndSelection()
{
    EndTracking( ENDTRACK_CANCEL );
    if ( ImplGetButtonState() & BUTTON_DRAW_PRESSED )
    if ( !IsDisposed() &&
         ImplGetButtonState() & BUTTON_DRAW_PRESSED )
    {
        ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED;
        if ( !mbPressed )
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 73987a1..4a89c0f 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -206,9 +206,9 @@ void TabControl::dispose()
    // delete TabCtrl data
    if ( mpTabCtrlData )
    {
        if( mpTabCtrlData->mpListBox )
            delete mpTabCtrlData->mpListBox;
        delete mpTabCtrlData->mpListBox;
        delete mpTabCtrlData;
        mpTabCtrlData = NULL;
    }
    Control::dispose();
}
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index fc3dc74..ca88656 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -136,6 +136,8 @@ namespace vcl {
            return pChild->GetAccessible();
    }
    */
    if ( !mpWindowImpl )
        return css::uno::Reference< css::accessibility::XAccessible >();
    if ( !mpWindowImpl->mxAccessible.is() && bCreate )
        mpWindowImpl->mxAccessible = CreateAccessible();

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 9975c97..b34a451 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -347,8 +347,8 @@ void Dialog::ImplInitDialogData()
    mbOldSaveBack           = false;
    mbInClose               = false;
    mbModalMode             = false;
    mpContentArea.disposeAndClear();
    mpActionArea.disposeAndClear();
    mpContentArea.clear();
    mpActionArea.clear();
    mnMousePositioned       = 0;
    mpDialogImpl            = new DialogImpl;
}
@@ -551,8 +551,8 @@ void Dialog::dispose()
{
    delete mpDialogImpl;
    mpDialogImpl = NULL;
    mpActionArea.disposeAndClear();
    mpContentArea.disposeAndClear();
    mpActionArea.clear();
    mpContentArea.clear();
    SystemWindow::dispose();
}