Commit Graph

18 Commits

Author SHA1 Message Date
Vadim Zeitlin
7f2468e96a Fix using weak references to incomplete classes.
wxWeakRef can work with forward-declared classes provided dynamic_cast<> is
available but this wasn't detected as being the case due to the use of the
obsolete HAVE_DYNAMIC_CAST in its code.

Replace HAVE_DYNAMIC_CAST with !wxNO_RTTI to fix this.

Also add a unit test checking that this does work.

Closes #11916.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-15 22:47:37 +00:00
Vadim Zeitlin
946ceed9cd Fix VC6 compilation which was somehow broken by adding wxWeakRef ctor.
For some mysterious reason, adding non-template wxWeakRef ctor breaks VC6
build with the apparently completely unrelated errors:

include\wx/toplevel.h(223) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class wxWindow *' (or there is no acceptable conversion)
include\wx/toplevel.h(231) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class wxWindow *' (or there is no acceptable conversion)
src\common\dummy.cpp(27) : error C2856: #pragma hdrstop cannot be inside an #if block

Simply don't define it for VC6 to at least allow the code not using wxWeakRef
to compile.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-12 13:08:01 +00:00
Vadim Zeitlin
43aecc4dd7 Add non-template wxWeakRef<T> constructor from T*.
We need a non-template ctor to make the code initializing wxWeakRef with
literal NULL to compile.

Closes #11916.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-10 18:13:29 +00:00
Vadim Zeitlin
fc4e23d7c1 Add wxWeakRef::element_type, remove unnecessary assignment operator.
Define element_type for consistency with other classes (wxSharedPtr, weak_ptr)
and to allow accessing the type from the template code.

Also remove the apparently unnecessary template assignment operator:
assignment from an expression convertible to type T* works even without it and
while assigning something implicitly convertible to T* wouldn't work now, it's
for the best as we don't want to rely on such implicit conversions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-10 18:13:23 +00:00
Paul Cornett
c4021a7920 use bool expression rather than implicit conversion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59001 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-18 18:02:53 +00:00
Vadim Zeitlin
014b109195 define USE_ONLY_STATIC_WEAKREF for g++ < 3.3 too (3.2 is reported not to work otherwise)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-12-19 09:58:49 +00:00
Paul Cornett
470f357fd2 make access for virtuals match base
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-16 18:20:21 +00:00
Vadim Zeitlin
074574b4a6 compilation fix for operator=() with DMC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-22 23:14:48 +00:00
Robert Roebling
26c66bc6ac [ 1960295 ] wxWeakRef - Reorganization and comments
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-15 11:50:35 +00:00
Robert Roebling
6dd21c5433 [ 1957970 ] wxWeakRef - assign from other wxWeakRef
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-06 21:04:23 +00:00
Vadim Zeitlin
7005cf4407 fix wxWeakRef<> for Borland C++ (slightly modified patch 1902415)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-27 18:12:29 +00:00
Vadim Zeitlin
5a0c7d664e use correct WXDLLIMPEXP_FWD_CORE instead of WXDLLIMPEXP_FWD_BASE for wxWindow forward declaration
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-11 20:51:24 +00:00
Vadim Zeitlin
42d9ad7949 removed unneeded wxWeakRefDynamic::AssignCopy() (last part of patch 1870445)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-16 02:09:00 +00:00
Vadim Zeitlin
34bfda8a38 compilation fixes for standard-conformant compilers and added back implicit conversion of wxWeakRef<T> to T* (part of patch 1870445)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51233 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-16 02:07:07 +00:00
Vadim Zeitlin
cc6ceca789 improvements to wxWeakRef and related classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-13 01:12:13 +00:00
Vadim Zeitlin
1e9192d04c add conversion to unspecified_bool_type to allow writing if(weakref)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51109 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-08 14:23:20 +00:00
Robert Roebling
9dd5ff5baa Updated wxWeakRef<T> to patch Weak references for wx - part 2, removed T*() and added T* get(), other minor docs corr
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-08 09:55:21 +00:00
Vadim Zeitlin
db7035e48a added wxWeakRef<T> (slightly modified patch 1860953)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-06 18:01:28 +00:00