summaryrefslogtreecommitdiff
path: root/include/vcl/vclptr.hxx
AgeCommit message (Collapse)Author
2023-04-23cid#1524746 silence Using a moved objectCaolán McNamara
Change-Id: I82728c481c721aeb0d70f6bbdf6f0f1b49ea7b8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150819 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-04-17Use move ctor hereMike Kaganski
Change-Id: Ic20b91ee6d674c7fe5f08f07c3f29fc9fbaf5282 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150524 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-28There appears to be no reason for (DBG_UTIL-only) ~VclPtr to be virtualStephan Bergmann
...ever since it was introduced with 3ecb9b4bd7dc70664bbb8d7c957ea8dc5015223f "tdf#99352: assert on stray VclPtrs past DeInit" Change-Id: I4b87a6bacb53f74ff612a4193cee42145ea04fdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117878 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-03use more compact namespace syntax in /includeNoel Grandin
excluding the UDK headers of course Change-Id: Iac7ab83d60265f7d362c860776f1de9d5e444ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93268 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-25tdf#130137 Replace remaining uses of WNT define checks with _WIN32A_GAN
Change-Id: If95f1ea5a81de62eb4f725e5fcb30ccb8530062a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87372 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-10-31loplugin:finalclasses in vclNoel Grandin
Change-Id: Id6dd59d0a335d84c513059ed7870135cf9959af8 Reviewed-on: https://gerrit.libreoffice.org/81827 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-07tdf#42949 Fix IWYU warnings in include/vcl/[v-x]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I98f49765c6b74808dcbd692e0f375dd2848fcfd4 Reviewed-on: https://gerrit.libreoffice.org/65614 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-08Clean up LIBO_INTERNAL_ONLY uses of SAL_WARN_UNUSED_RESULTStephan Bergmann
Change-Id: I98b2d90c8345f07010f6defd82557188d5cd35c7 Reviewed-on: https://gerrit.libreoffice.org/64808 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-30Remove obsolete _MSC_VER checksStephan Bergmann
...after 206b8c4ae320d7d8614f21800d8f77fa29f8f5ff "On Windows, check for at least Visual Studio 2017 version 15.7" Change-Id: I38ee86e1649bbdc828a7e328f2dbbac0dc163c8a Reviewed-on: https://gerrit.libreoffice.org/64250 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-11Use [[nodiscard]] in SAL_WARN_UNUSED_RESULT where availableStephan Bergmann
...which required some lax placements of SAL_WARN_UNUSED_RESULT to be fixed. Also, Clang unfortunately is rather picky about the relative order of SAL_WARN_UNUSED_RESULT expanding to [[nodiscard]] and uses of the DLLPUBLIC macros (expanding to __attribute__(...) resp. __declspec(..) for clang-cl). Change-Id: Iae6ca36bef97f1864873aefdb5f05c7f5e045ad3 Reviewed-on: https://gerrit.libreoffice.org/60274 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-27vcl: avoid -Werror=deprecated-copy (GCC trunk towards GCC 9)Stephan Bergmann
...by explicitly defaulting the copy/move functions (and, where needed in turn, also a default ctor) for classes that have a user-declared dtor that does nothing other than an implicitly-defined one would do, but needs to be user- declared because it is virtual and potentially serves as a key function to emit the vtable, or is non-public, etc.; and by removing explicitly user- provided functions that do the same as their implicitly-defined counterparts, but may prevent implicitly declared copy functions from being defined as non- deleted in the future. (Even if such a user-provided function was declared non-inline in an include file, the apparently-used implicitly-defined copy functions are already include, so why bother with non-inline functions.) Change-Id: Ife5d8eb699b8b6c84b9229ae275dc386fa189bce Reviewed-on: https://gerrit.libreoffice.org/58105 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-05-31Guard against ScopedVclPtr "self assignment" (just in case)Stephan Bergmann
Change-Id: I12bbfbc6701e4e666d30dcf89c17be8f1a5d6858
2017-05-30Dispose pDlgInterface member during destructionStephan Bergmann
Requires a VclPtr -> ScopedVclPtr assignment operator, similar to the existing VclPtr -> ScopedVclPtr constructor. Change-Id: I2b43967ee84f90eea20f8eaa17741229473752b1
2017-05-30Use std::is_base_of instead of own UpCastStephan Bergmann
...and no need here to wrap code in /// @cond INTERNAL Change-Id: I4bc613728c73deab3fe1e22ccd0c3fad51252ce8 Reviewed-on: https://gerrit.libreoffice.org/38221 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-05-22verify that VclPtr properly disposedNoel Grandin
Change-Id: Ia76b7ad9e6d7fefaf0088372b5f5fc7dc51c2846 Reviewed-on: https://gerrit.libreoffice.org/37649 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-03remove empty namespacesJochen Nitschke
Change-Id: I3eae0ecc1ffc5500d3c55abc6554822f5432a50a Reviewed-on: https://gerrit.libreoffice.org/37173 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-21remove some old MSVC workaroundsNoel Grandin
Change-Id: I6abd8aaffb27b3c85df7c0518f7f576be4e32222 Reviewed-on: https://gerrit.libreoffice.org/36660 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-04tdf#99352: assert on stray VclPtrs past DeInitBjoern Michaelsen
- ignore on Windows for now, as it is acting up Change-Id: I98dbb887ed556b58188870c3eb3de1327bc58109 Reviewed-on: https://gerrit.libreoffice.org/35816 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2017-03-25Fix typosAndrea Gelmini
Change-Id: Ia8bd59be341b0731198d48df974b60ecb04e289c Reviewed-on: https://gerrit.libreoffice.org/35635 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-03Remove redundant 'inline' keywordStephan Bergmann
...from function definitions occurring within class definitions. Done with a rewriting Clang plugin (to be pushed later). Change-Id: I9c6f2818a57ccdb361548895a7743107cbacdff8 Reviewed-on: https://gerrit.libreoffice.org/34874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02Remove HAVE_CXX11_CONSTEXPR, always true nowStephan Bergmann
...after 84b36c704d73362d4d86dc9e9c0efa0625958347 "Drop support for MSVC 2013". Make this a fatal configuration error for now. The check should be removed completely after LO 5.4 branch-off. Change-Id: I990fd8fcb4ec1327282df4efe21640c938d3cf06 Reviewed-on: https://gerrit.libreoffice.org/34821 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-03Mark [Scoped]VclPtrInstance as SAL_WARN_UNUSEDStephan Bergmann
Stack-allocated instances of the non-Instance [Scoped]VclPtr variants are occasionally used merely for the side-effect of holding objects alive (like css::uno::Reference and rtl::Reference, which are also not SAL_WARN_UNUSED for that reason). Change-Id: I37ebfaf028a646cb2777c0baf0d99992057a22bd
2016-12-19MSVC 2015 apparently fails the sizeof(incomplete) SFINAE trickStephan Bergmann
...at least with --disable-pch it complained > [build CXX] canvas/source/directx/dx_bitmapcanvashelper.cxx > C:/lo/core/include\vcl/vclptr.hxx(98): error C2027: use of undefined type 'OutputDevice' > c:\lo\core\canvas\source\directx\dx_devicehelper.hxx(33): note: see declaration of 'OutputDevice' > c:\lo\core\canvas\source\directx\dx_devicehelper.hxx(109): note: see reference to class template instantiation 'VclPtr<OutputDevice>' being compiled Change-Id: I3ba90acdb632fc209b8137818e30fb771ba0807c
2016-12-14Check that VclPtr is only instantiated with appropriate typesStephan Bergmann
...deriving from VclReferenceBase. Complicated by the fact that the argument type may be incomplete at the time of template instantiation. So this approach may be less precise than the change to loplugin:vclwidgets from cbf5b21f2a65bbb342295200f6ad93a00f90733e "Catch some misuses of VclPtr construction" when the argument type becomes complete later in the comilation unit. However, this approach would also catch the two misuses in UnoControls found by cbf5b21f2a65bbb342295200f6ad93a00f90733e, so go with this approach for now and revert the change to loplugin:vclwdigets. Change-Id: I7888f23d2b9e2db81ae2ce4bf4c8277912317685 Reviewed-on: https://gerrit.libreoffice.org/31966 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-06Make VclPtr move assignment operator actually moveStephan Bergmann
071e23fee07b92b8f07800cda3ca7e66afe818ae "add move operators for VclPtr" added (among other things) a move assignment operator that rather copied m_rInnerRef. But if b72c6feba87bd8707f39902a3066ba476188cb1d "manage VCL widgets using rtl::Reference" had not pointlessly introduced a user-declared copy constructor in the first place, all the copy/move special member functions would be implicitly declared (as VclPtr does not have a user-declared destructor). Change-Id: I1bec05a7a1b5b48a7b7d74e64a88f118454f8cb2
2016-11-26mark VclPtr::Create as SAL_WARN_UNUSED_RESULTNoel Grandin
Change-Id: I7b5bb8a0ed8848c9e426d2015983156e34947914 Reviewed-on: https://gerrit.libreoffice.org/31202 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-11add move operators for VclPtrNoel Grandin
Change-Id: Ic32894d13aac2d8038afec2efebcc544f1c408af Reviewed-on: https://gerrit.libreoffice.org/30748 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-09disallow calls to ::Create in VclPtr subclassesNoel Grandin
where it can be actively dangerous, if the calling code thinks it's creating a ScopedVclPtrInstance, and it actually only gets a VclPtr Change-Id: I638b28207d60e8fc4ca3d31000c0735d06ce2eb3 Reviewed-on: https://gerrit.libreoffice.org/28714 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-08vcl: should be using @tparam for template parametersChris Sherlock
Change-Id: I650448b4c24173a88b594185c2332861288ec753
2016-01-08vcl: doxygen issue - missing @endcond in vclptr.hxxChris Sherlock
Change-Id: I5cb9566e372568a8836803807e730f983bdff4cd
2015-12-10loplugin:nullptr: More NULL -> nullptr automatic rewriteStephan Bergmann
Change-Id: Ie83819e2bcdc5fa160b39296b005ca9a5ff74b1d
2015-10-13No std container requires operator >Stephan Bergmann
Change-Id: Ic5befe71c9cb4ffa37b3298b269bcd7ef713b937
2015-10-12Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I328ac7a95ccc87732efae48b567a0556865928f3
2015-09-21hide ScopedPtr::reset and add disposeAndClearCaolán McNamara
Change-Id: I55d6e789abd408b8478a2b9ae141d8899af2c309 Reviewed-on: https://gerrit.libreoffice.org/18745 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-04warning C4521: multiple copy constructors specifiedStephan Bergmann
Change-Id: I1b28b6d18e33b85e335ca24e717e3eef7077cf8f
2015-09-04Prevent perfect forwarding ctor from hijacking copy construction attemptsStephan Bergmann
...and hope that this will already be enough to help MSVC 2015 re. <http://paste.openstack.org/show/444734/>. "This leads to beavior that's intuitive only if you've spent so much time around compilers and compiler-writers, you've forgotten what it's like to be human," as Meyers so aptly put it. Change-Id: I4015bf831cd4cfed6988cc3517f719b756e27bb8
2015-07-09Workaround seems no longer necessary for MSVC 2013David Ostrovsky
Moreover, the removed code doesn't compile on MSVC 2015. Change-Id: I400df7b7934a8965a204009328d44e74f220fc37 Reviewed-on: https://gerrit.libreoffice.org/16805 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2015-06-15Fix VclPtr assignment operatorsStephan Bergmann
The original templated assignment operator would never have been used, as std::enable_if expects a bool value as first template argument. But it was also unnecessary anyway: (1) Assignment from VclPtr<reference_type> was (and is) covered by the implicitly defined copy assignment operator. (2) Assignment from naked reference_type* was covered by the user-supplied constructor from reference_type* to temporary, followed by (1); it is now covered directly by the user-supplied assignment operator from reference_type*. (3) Assignment from VclPtr<derived_type> was covered by the user-supplied, templated constructor from VclPtr<derived_type> to temporary, followed by (1); it is now covered directly by the user-supplied, templated assignment operator from VclPtr<derived_type>. (4) Assignment from naked derived_type* was (and is) covered by an implicit pointer up-cast, followed by (2). Change-Id: I3c7527feea72fdda76d911a42ae856c353b700b5
2015-06-02There is no use of vcl::Window hereTor Lillqvist
Change-Id: Idf36c08205a8a3a36ae05040e1c1fd28d5e2f13f
2015-05-27The Mac libc++ version has problems as well,Stephan Bergmann
...so remove the deleted address-of operator again for now Change-Id: I3ded1d28bf2aeb170c70bcec865c09df1eefcb08
2015-05-27Work around broken MSVC standard libraryStephan Bergmann
Change-Id: I9bbe6d231cc784f786dc5e31a641b8789fc35eb9
2015-05-27Prevent accidental mis-uses of VclPtr address-of operatorStephan Bergmann
Change-Id: Ie3588d502e9545ea64bf836b2a0bdc0caead2247
2015-04-29Make MSVC happy?Stephan Bergmann
Change-Id: I66b151aa726f6465f79003508520662e62b718aa
2015-04-29Better make the bool conversion operator explicitStephan Bergmann
Change-Id: I1ac9cb24cd51e3721cb903b5033054056b540bb8
2015-04-29Remove unnecessary SAL_CALL annotationsStephan Bergmann
Change-Id: I4de69ef35b2ea715cb6b2223cfbb7d30c4cbbdec
2015-04-17sw: convert new to ::Create.Noel Grandin
Change-Id: I937aa67ee4a3b07bd180daaaa3c665245ea08b92
2015-04-13VclPtr - add a templatized ::Create method for better readability.Michael Meeks
Change-Id: I2437198709ba4848d975efd1ebb4df1071c6c8f1
2015-04-10automated VclPtrInstance conversion.Michael Meeks
Change-Id: I9a1d47202e2794461f6ec44f3e72ee1dd2fde09d
2015-04-10vclptr: create Instance helpers, and set initial ref-count to 1.Michael Meeks
Document that in README.lifecycle; the problem is that our constructors currently take and release references left/right on the object being created, which ... means we need an initial reference. Change-Id: I5de952b73ac67888c3fbb150d4a7cde2a7bc9abf
2015-04-10vclwidget: add some safety net assertsNoel Grandin
Change-Id: I5fa19ec6161ab97eb7df8b52a268917f41ae2205