Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13701/src/gui
Modified Files:
wxMainFrame.cpp
Log Message:
MainFrame::OpenFolder() used to decref the folder passed to it which was
completely unexpected and resulted in a bug in resume code; changed it and the
code using it to not do it any more which also fixed the bug
Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.196
retrieving revision 1.197
diff -b -u -2 -r1.196 -r1.197
--- wxMainFrame.cpp 25 Jun 2006 14:04:37 -0000 1.196
+++ wxMainFrame.cpp 2 Jul 2006 12:23:13 -0000 1.197
@@ -137,18 +137,28 @@
virtual void OnOpenHere(MFolder *folder)
{
- // attention, base version of OnOpenHere() will DecRef() the folder, so
- // compensate for it
- SafeIncRef(folder);
- wxFolderTree::OnOpenHere(folder);
+ CHECK_RET( folder, _T("can't open a NULL folder") );
+
+ if ( !m_frame->OpenFolder(folder) )
+ {
+ // normally the base class version DecRef()s it but as we're going to
+ // pass NULL to it, do it ourselves
+ folder->DecRef();
+ folder = NULL;
+ }
- m_frame->OpenFolder(folder);
+ wxFolderTree::OnOpenHere(folder);
}
virtual void OnView(MFolder *folder)
{
- SafeIncRef(folder);
- wxFolderTree::OnView(folder);
+ CHECK_RET( folder, _T("can't view a NULL folder") );
- m_frame->OpenFolder(folder, true /* RO */);
+ if ( !m_frame->OpenFolder(folder, true /* RO */) )
+ {
+ folder->DecRef();
+ folder = NULL;
+ }
+
+ wxFolderTree::OnView(folder);
}
@@ -192,5 +202,5 @@
// no more unread messages here, go to the next unread folder
- MFolder *folder = m_mainFrame->GetFolderTree()->FindNextUnreadFolder();
+ MFolder_obj folder(m_mainFrame->GetFolderTree()->FindNextUnreadFolder());
if ( !folder )
{
@@ -682,33 +692,27 @@
}
-void
+bool
wxMainFrame::OpenFolder(MFolder *pFolder, bool readonly)
{
-#ifdef HAS_DYNAMIC_MENU_SUPPORT
- static bool s_hasMsgMenu = false;
-#endif
+ CHECK( pFolder, false, "can't open NULL folder" );
+ pFolder->IncRef(); // to compensate for DecRef() by MFolder_obj
MFolder_obj folder(pFolder);
// don't do anything if there is nothing to change
- if ( folder.IsOk() && (m_folderName == folder->GetFullName()) )
+ const String folderName = folder->GetFullName();
+ if ( m_folderName == folderName )
{
wxLogStatus(this, _("The folder '%s' is already opened."),
m_folderName.c_str());
- return;
+ return true;
}
- else if ( folder )
- m_folderName = folder->GetFullName();
- else if ( m_folderName.empty() )
- return;
- else
- m_folderName.Empty();
- if ( folder )
- {
- // we want save the full folder name in m_folderName
- ASSERT( folder->GetFullName() == m_folderName );
+ // save the full folder name in m_folderName for use from elsewhere
+ m_folderName = folderName;
+
+ // and do try to open the folder
if ( !m_FolderView->OpenFolder(folder, readonly) )
{
@@ -726,7 +730,8 @@
m_FolderTree->SelectFolder(folder);
}
- }
+
#ifdef HAS_DYNAMIC_MENU_SUPPORT
// only add the msg menu once
+ static bool s_hasMsgMenu = false;
if ( !s_hasMsgMenu )
{
@@ -736,8 +741,5 @@
#endif // HAS_DYNAMIC_MENU_SUPPORT
-#ifdef HAS_DYNAMIC_MENU_SUPPORT
- // TODO remove the message menu - wxMenuBar::Delete() not implemented
- // currently in wxGTK and is somewhat broken in wxMSW
-#endif // HAS_DYNAMIC_MENU_SUPPORT
+ return !m_folderName.empty();
}
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates