Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv9986/src/modules
Modified Files:
BareBonesEditor.cpp
Log Message:
fixed attachments crashes
Index: BareBonesEditor.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/BareBonesEditor.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -u -2 -r1.2 -r1.3
--- BareBonesEditor.cpp 28 Aug 2003 14:22:46 -0000 1.2
+++ BareBonesEditor.cpp 31 Aug 2003 13:46:37 -0000 1.3
@@ -678,13 +678,6 @@
m_attachments->GetItem(itemProperties);
- EditorContentPart *file
- = (EditorContentPart *)itemProperties.GetData();
-
- itemProperties.SetData((void *)NULL);
-#if !wxCHECK_VERSION(2,5,0)
- itemProperties.SetMask(itemProperties.GetMask() & ~wxLIST_MASK_DATA);
-#endif
- m_attachments->SetItem(itemProperties);
-
+ EditorContentPart *file = (EditorContentPart *)itemProperties.GetData();
+ if ( file )
file->DecRef();
}
@@ -892,7 +885,5 @@
item.SetImage(
m_attachments->GetImageList(wxIMAGE_LIST_NORMAL)->Add(icon));
-#if !wxCHECK_VERSION(2,5,0)
item.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE | wxLIST_MASK_DATA);
-#endif
m_attachments->InsertItem(item);
@@ -920,9 +911,12 @@
EditorContentPart *BareBonesEditor::GetNextPart()
{
- if(m_getNextAttachement < 0)
- return NULL;
+ const int count = m_attachments->GetItemCount();
+
+ CHECK( m_getNextAttachement >= 0 || m_getNextAttachement < count, NULL,
+ _T("forgot to call BareBonesEditor::GetFirstPart()?") );
- if(m_getNextAttachement >= m_attachments->GetItemCount())
+ if ( m_getNextAttachement == count )
{
+ // no more parts
m_getNextAttachement = -1;
return NULL;
@@ -930,12 +924,19 @@
wxListItem item;
- item.SetId(m_getNextAttachement);
+ item.SetId(m_getNextAttachement++);
+ item.SetMask(wxLIST_MASK_DATA);
m_attachments->GetItem(item);
EditorContentPart *file = (EditorContentPart *)item.GetData();
+ if ( file )
+ {
file->IncRef();
-
- ++m_getNextAttachement;
+ }
+ else
+ {
+ FAIL_MSG( _T("NULL attachment in wxBareBonesAttachments?") );
+ }
return file;
}
+
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates