NEVER call thisRef() from the object's constructor.
This commit is contained in:
parent
8223f059a5
commit
5c3e21ee1d
@ -45,8 +45,8 @@ private:
|
|||||||
|
|
||||||
friend class vmime::creator;
|
friend class vmime::creator;
|
||||||
|
|
||||||
IMAPpart(weak_ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
|
IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
|
||||||
IMAPpart(weak_ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part);
|
IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -69,12 +69,19 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
static ref <IMAPpart> create
|
static ref <IMAPpart> create
|
||||||
(weak_ref <IMAPpart> parent, const int number, const IMAPParser::body* body)
|
(ref <IMAPpart> parent, const int number, const IMAPParser::body* body)
|
||||||
{
|
{
|
||||||
if (body->body_type_mpart())
|
if (body->body_type_mpart())
|
||||||
return vmime::create <IMAPpart>(parent, number, body->body_type_mpart());
|
{
|
||||||
|
ref <IMAPpart> part = vmime::create <IMAPpart>(parent, number, body->body_type_mpart());
|
||||||
|
part->m_structure = vmime::create <IMAPstructure>(part, body->body_type_mpart()->list());
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return vmime::create <IMAPpart>(parent, number, body->body_type_1part());
|
return vmime::create <IMAPpart>(parent, number, body->body_type_1part());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +125,7 @@ public:
|
|||||||
m_parts.push_back(IMAPpart::create(NULL, 1, body));
|
m_parts.push_back(IMAPpart::create(NULL, 1, body));
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAPstructure(weak_ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
|
IMAPstructure(ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
|
||||||
{
|
{
|
||||||
int number = 1;
|
int number = 1;
|
||||||
|
|
||||||
@ -163,18 +170,15 @@ IMAPstructure IMAPstructure::m_emptyStructure;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
IMAPpart::IMAPpart(weak_ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
|
IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
|
||||||
: m_parent(parent), m_header(NULL), m_number(number), m_size(0)
|
: m_parent(parent), m_header(NULL), m_number(number), m_size(0)
|
||||||
{
|
{
|
||||||
m_mediaType = vmime::mediaType
|
m_mediaType = vmime::mediaType
|
||||||
("multipart", mpart->media_subtype()->value());
|
("multipart", mpart->media_subtype()->value());
|
||||||
|
|
||||||
m_structure = vmime::create <IMAPstructure>
|
|
||||||
(thisWeakRef().dynamicCast <IMAPpart>(), mpart->list());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IMAPpart::IMAPpart(weak_ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part)
|
IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part)
|
||||||
: m_parent(parent), m_header(NULL), m_number(number), m_size(0)
|
: m_parent(parent), m_header(NULL), m_number(number), m_size(0)
|
||||||
{
|
{
|
||||||
if (part->body_type_text())
|
if (part->body_type_text())
|
||||||
|
@ -69,24 +69,28 @@ protected:
|
|||||||
void releaseWeak(utility::weak_ref_base* w) const;
|
void releaseWeak(utility::weak_ref_base* w) const;
|
||||||
|
|
||||||
/** Return a reference to this object.
|
/** Return a reference to this object.
|
||||||
|
* \warning NEVER CALL THIS FROM A CONSTRUCTOR!
|
||||||
*
|
*
|
||||||
* @return reference to self
|
* @return reference to self
|
||||||
*/
|
*/
|
||||||
ref <object> thisRef();
|
ref <object> thisRef();
|
||||||
|
|
||||||
/** Return a reference to this object (const version).
|
/** Return a reference to this object (const version).
|
||||||
|
* \warning NEVER CALL THIS FROM A CONSTRUCTOR!
|
||||||
*
|
*
|
||||||
* @return reference to self
|
* @return reference to self
|
||||||
*/
|
*/
|
||||||
ref <const object> thisRef() const;
|
ref <const object> thisRef() const;
|
||||||
|
|
||||||
/** Return a weak reference to this object.
|
/** Return a weak reference to this object.
|
||||||
|
* \warning NEVER CALL THIS FROM A CONSTRUCTOR!
|
||||||
*
|
*
|
||||||
* @return weak reference to self
|
* @return weak reference to self
|
||||||
*/
|
*/
|
||||||
weak_ref <object> thisWeakRef();
|
weak_ref <object> thisWeakRef();
|
||||||
|
|
||||||
/** Return a weak reference to this object (const version).
|
/** Return a weak reference to this object (const version).
|
||||||
|
* \warning NEVER CALL THIS FROM A CONSTRUCTOR!
|
||||||
*
|
*
|
||||||
* @return weak reference to self
|
* @return weak reference to self
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user