mend misc. lifecycle breakage.

Change-Id: I6e960db9659f5122a45c4cf173e680bb782acf76
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 5ff2f06..4d5eaa4 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -508,12 +508,14 @@ void MediaWindowImpl::onURLChanged()
{
    if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON )
    {
        mpChildWindow.disposeAndClear();
        mpChildWindow.reset(new MediaChildWindow(this) );
    }
#if HAVE_FEATURE_GLTF
    else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON )
    {
        SystemWindowData aWinData = OpenGLContext::generateWinData(this, false);
        mpChildWindow.disposeAndClear();
        mpChildWindow.reset(new MediaChildWindow(this,&aWinData));
        mbEventTransparent = false;
    }
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index bba59e83..03ba2b1 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -240,7 +240,7 @@ ViewShellBase::ViewShellBase (
      mpDocument (NULL)
{
    mpImpl.reset(new Implementation(*this));
    mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
    mpImpl->mpViewWindow = new FocusForwardingWindow(_pFrame->GetWindow(),*this);
    mpImpl->mpViewWindow->SetBackground(Wallpaper());

    _pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
@@ -1028,7 +1028,7 @@ ViewShellBase::Implementation::~Implementation (void)
{
    mpController = NULL;
    mpViewTabBar = NULL;
    mpViewWindow.reset();
    mpViewWindow.disposeAndClear();
    mpToolBarManager.reset();
}

diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2f08b03..b42b71f 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -191,6 +191,8 @@ DrawViewShell::~DrawViewShell()

    mpFrameView->Disconnect();
    delete [] mpSlotArray;

    maTabControl.disposeAndClear();
}

/**
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 4076a09..c4b6f4f 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -151,7 +151,7 @@ ViewShell::~ViewShell()

    delete mpZoomList;

    mpLayerTabBar.reset();
    mpLayerTabBar.disposeAndClear();

    if (mpImpl->mpSubShellFactory.get() != NULL)
        GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
@@ -163,8 +163,14 @@ ViewShell::~ViewShell()
            "sd.ui",
            "destroying mpContentWindow at " << mpContentWindow.get()
                << " with parent " << mpContentWindow->GetParent());
        mpContentWindow.reset();
        mpContentWindow.disposeAndClear();
    }

    mpScrollBarBox.disposeAndClear();
    mpVerticalRuler.disposeAndClear();
    mpHorizontalRuler.disposeAndClear();
    mpVerticalScrollBar.disposeAndClear();
    mpHorizontalScrollBar.disposeAndClear();
}

/**
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 8fd29e4..2df93f1 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -338,15 +338,7 @@ struct TabBar_Impl

    svt::AccessibleFactoryAccess  maAccessibleFactory;

    TabBar_Impl()
        : mpSizer()
        , mpFirstButton()
        , mpPrevButton()
        , mpNextButton()
        , mpLastButton()
        , mpEdit()
        , mpItemList()
    {}
    TabBar_Impl() {}

    ~TabBar_Impl()
    {
@@ -367,6 +359,10 @@ struct TabBar_Impl
    {
        return static_cast<sal_uInt16>(mpItemList.size());
    }
    ~TabBar_Impl()
    {
        mpSizer.disposeAndClear();
    }
};

TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :