vcl/source/window/builder.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
New commits: commit 6a4b9bf503204b5770ad314eae0bfed18c5d84c7 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Feb 17 23:42:55 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Feb 18 10:28:58 2024 +0100 tdf#130857 VclBuilder: Use VclPtr instead of raw vcl::Window* `VclBuilder::handleObject` returns a `VclPtr<vcl::Window>`. Use the same for the local variable `pCurrentChild` that the return value of the former is assigned to. There's no reason to use a raw pointer here and explicitly calling `VclPtr<vcl::Window>::get()` also makes it harder to reuse/share the existing code for an upcoming `QtBuilder`, s. Omkar's comment in his pending Gerrit change [1]. While at it, also move the declaration of `pCurrentChild` closer to its first use. [1] https://gerrit.libreoffice.org/c/core/+/163103/comments/f37a6add_b0f00eb1 Change-Id: I30520d5d18453c78150b2b0c9af044e043a1c74f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163528 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ff20cd07be2b..28d789f64b8f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2799,8 +2799,6 @@ void VclBuilder::tweakInsertedChild(vcl::Window *pParent, vcl::Window* pCurrentC void VclBuilder::handleChild(vcl::Window *pParent, stringmap* pAtkProps, xmlreader::XmlReader &reader) { - vcl::Window *pCurrentChild = nullptr; - xmlreader::Span name; int nsId; OString sType, sInternalChild; @@ -2825,6 +2823,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, stringmap* pAtkProps, xmlread return; } + VclPtr<vcl::Window> pCurrentChild; int nLevel = 1; while(true) { @@ -2835,7 +2834,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, stringmap* pAtkProps, xmlread { if (name == "object" || name == "placeholder") { - pCurrentChild = handleObject(pParent, pAtkProps, reader).get(); + pCurrentChild = handleObject(pParent, pAtkProps, reader); bool bObjectInserted = pCurrentChild && pParent != pCurrentChild; if (bObjectInserted)