Correct wxObjectDataPtr<> assignment from *T to not increase the ref count
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -146,8 +146,9 @@ counted object to which this class points.
|
|||||||
|
|
||||||
\constfunc{T*}{operator->}{\void}
|
\constfunc{T*}{operator->}{\void}
|
||||||
|
|
||||||
Gets a pointer to the reference counted object to which
|
Returns a pointer to the reference counted object to which
|
||||||
this class points. Same as \helpref{get}{wxobjectdataptrget}.
|
this class points. If this the internal pointer is NULL,
|
||||||
|
this method will assert in debug mode.
|
||||||
|
|
||||||
\membersection{wxObjectDataPtr<T>::operator=}\label{wxobjectdataptroperatorassign}
|
\membersection{wxObjectDataPtr<T>::operator=}\label{wxobjectdataptroperatorassign}
|
||||||
|
|
||||||
|
@@ -456,7 +456,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
T *get() const { return m_ptr; }
|
T *get() const { return m_ptr; }
|
||||||
T *operator->() const { return get(); }
|
|
||||||
|
T *operator->() const
|
||||||
|
{
|
||||||
|
wxASSERT(m_ptr != NULL);
|
||||||
|
return get();
|
||||||
|
}
|
||||||
|
|
||||||
void reset(T *ptr)
|
void reset(T *ptr)
|
||||||
{
|
{
|
||||||
@@ -480,8 +485,6 @@ public:
|
|||||||
if (m_ptr)
|
if (m_ptr)
|
||||||
m_ptr->DecRef();
|
m_ptr->DecRef();
|
||||||
m_ptr = ptr;
|
m_ptr = ptr;
|
||||||
if (m_ptr)
|
|
||||||
m_ptr->IncRef();
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -169,6 +169,11 @@ public:
|
|||||||
m_classicalMusicIsKnownToControl = false;
|
m_classicalMusicIsKnownToControl = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~MyMusicModel()
|
||||||
|
{
|
||||||
|
delete m_root;
|
||||||
|
}
|
||||||
|
|
||||||
// helper method for wxLog
|
// helper method for wxLog
|
||||||
|
|
||||||
wxString GetTitle( const wxDataViewItem &item )
|
wxString GetTitle( const wxDataViewItem &item )
|
||||||
@@ -575,6 +580,7 @@ class MyFrame : public wxFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h);
|
MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h);
|
||||||
|
~MyFrame();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
@@ -842,6 +848,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
|
|||||||
SetSizer( main_sizer );
|
SetSizer( main_sizer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
delete wxLog::SetActiveTarget(m_logOld);
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
|
Reference in New Issue
Block a user