Resolves: tdf#159879 Crash when closing "3D View" dialog

Change-Id: I9c116007afe9cea97b597933ad8483dce25c3707
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164274
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 2020365..3d7d2f3 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -251,6 +251,8 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Contain

ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
{
    // drop page view before the widget it paints to is destroyed
    m_xPreview->ClearPageView();
}

IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx
index 16873e7..191b9b4 100644
--- a/include/svx/dlgctl3d.hxx
+++ b/include/svx/dlgctl3d.hxx
@@ -61,6 +61,7 @@ public:
    SvxPreviewObjectType GetObjectType() const { return mnObjectType; }
    SfxItemSet const & Get3DAttributes() const;
    virtual void Set3DAttributes(const SfxItemSet& rAttr);
    void ClearPageView();
};

class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DLightControl final : public Svx3DPreviewControl
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index e315819..319b0a2d 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -58,6 +58,11 @@ void Svx3DPreviewControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
    Construct();
}

void Svx3DPreviewControl::ClearPageView()
{
    mp3DView->ClearPageView();
}

Svx3DPreviewControl::~Svx3DPreviewControl()
{
    mp3DObj.clear();