[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Re: Serial number-related trouble, again
From: David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date: 2005-05-26 15:24:05
Message-ID: 200505261724.06662.dfaure () klaralvdalens-datakonsult ! se
[Download RAW message or body]
Similarly, this assumption in KMReaderWin::setMsg is simply broken:
// assume if a serial number exists it can be used to find the assoc KMMessage
if (mLastSerNum <= 0)
mMessage = aMsg;
else
mMessage = 0;
if (message() != aMsg) {
mMessage = aMsg;
mLastSerNum = 0; // serial number was invalid
Q_ASSERT(0);
}
where message() does
kmkernel->msgDict()->getLocation( mLastSerNum, &folder, &index );
This isn't going to work, ever, since the KMMessage that is in the folder
is the initial one (the one we made a copy of, in kmmainwidget.cpp),
and the KMMessage we're comparing it to (aMsg) is the copy.
So message() != aMsg, always (at least when coming from KMMainWidget::slotMsgActivated)
How about the following simplification, to fix the broken assumption and the Q_ASSERT(0)
happening all the time? We shouldn't need to run self-tests at runtime, especially when
we know they're going to fail because aMsg is a copy :)
--- kmreaderwin.cpp (revision 415305)
+++ kmreaderwin.cpp (working copy)
@@ -931,18 +931,13 @@
mDelayedMarkTimer.stop();
- mLastSerNum = (aMsg) ? aMsg->getMsgSerNum() : 0;
- if ( !aMsg ) mWaitingForSerNum = 0; // otherwise it has been set
-
- // assume if a serial number exists it can be used to find the assoc KMMessage
- if (mLastSerNum <= 0)
- mMessage = aMsg;
- else
- mMessage = 0;
- if (message() != aMsg) {
- mMessage = aMsg;
- mLastSerNum = 0; // serial number was invalid
- Q_ASSERT(0);
+ if ( !aMsg ) {
+ mWaitingForSerNum = 0; // otherwise it has been set
+ mLastSerNum = 0;
+ mMessage = 0;
+ } else {
+ mLastSerNum = aMsg->getMsgSerNum();
+ mMessage = aMsg;
}
if (aMsg) {
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic