[Libreoffice-commits] core.git: include/vcl test/source
Caolán McNamara
caolanm at redhat.com
Wed Feb 28 08:40:29 UTC 2018
include/vcl/builder.hxx | 2 ++
test/source/screenshot_test.cxx | 15 +++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
New commits:
commit ec7f0c0d5a7c672ac745671d3fbec51200f8a871
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 27 14:11:51 2018 +0000
ensure [Message]Dialog dispose order on direct .ui hackery
Change-Id: I31f190a1232331dd2076cdb8583e2036887f4f9f
Reviewed-on: https://gerrit.libreoffice.org/50441
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 6e47c022b844..c649e9904e6a 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -40,6 +40,7 @@ class MessageDialog;
class NumericFormatter;
class PopupMenu;
class SalInstanceBuilder;
+class ScreenshotTest;
class ScrollBar;
class Slider;
class DateField;
@@ -486,6 +487,7 @@ protected:
std::unique_ptr<VclBuilder> m_pUIBuilder;
friend class ::SalInstanceBuilder;
+ friend class ::ScreenshotTest;
};
/*
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index 44c7403fb836..2e7575b0f48d 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -184,19 +184,30 @@ void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription)
VclPtrInstance<Dialog> pDialog(Application::GetDefDialogParent(), WB_STDDIALOG | WB_SIZEABLE, Dialog::InitFlag::NoParent);
{
- VclBuilder aBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8));
- vcl::Window *pRoot = aBuilder.get_widget_root();
+ VclPtr<vcl::Window> aOwnedToplevel;
+
+ std::unique_ptr<VclBuilder> xBuilder(new VclBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8)));
+ vcl::Window *pRoot = xBuilder->get_widget_root();
Dialog *pRealDialog = dynamic_cast<Dialog*>(pRoot);
if (!pRealDialog)
{
pRealDialog = pDialog;
}
+ else
+ {
+ aOwnedToplevel.set(pRoot);
+ xBuilder->drop_ownership(pRoot);
+ }
pRealDialog->SetText(utl::ConfigManager::getProductName());
pRealDialog->SetStyle(pDialog->GetStyle() | WB_CLOSEABLE);
dumpDialogToPath(*pRealDialog);
+
+ if (VclBuilderContainer* pOwnedToplevel = dynamic_cast<VclBuilderContainer*>(aOwnedToplevel.get()))
+ pOwnedToplevel->m_pUIBuilder = std::move(xBuilder);
+ aOwnedToplevel.disposeAndClear();
}
pDialog.disposeAndClear();
More information about the Libreoffice-commits
mailing list