messagebox caching in kio

David Faure faure at kde.org
Sun May 4 10:58:42 UTC 2014


Hi Dawit,

I'm seeing an infinite loop in kio_http due to this code from 
tcpslavebase.cpp:

817│     int msgResult;
818│     do {
819│         msgResult = messageBox(WarningYesNoCancel, message,
820│                                i18n("Server Authentication"),
821│                                i18n("&Details"), i18n("Co&ntinue"));
822│         if (msgResult == KMessageBox::Yes) {
823│             //Details was chosen- show the certificate and error details
824├>            messageBox(SSLMessageBox /*the SSL info dialog*/, d->host);
825│         } else if (msgResult == KMessageBox::Cancel) {
826│             return ResultFailed;
827│         }
828│         //fall through on KMessageBox::No
829│     } while (msgResult == KMessageBox::Yes);

The problem is that UserNotificationHandler::processRequest() in KIO says
 77│         if (m_cachedResults.contains(key)) {
 78├>            result = *(m_cachedResults[key]);
i.e. it will never show the same messagebox twice (from the same 
slave+host+msgbox type).

So if one clicks "Details", the cached reply to the WarningYesNoCancel box is 
"Yes", and the cached reply to SSLMessageBox is ok, and the tcpslavebase code 
loops forever.

1) I think SSLMessageBox should never use the cache, but that doesn't help 
much, that fix alone would lead to a ssl message box coming up forever after 
closing it.

2) the point of the cache was to handle *concurrent* requests, right?
Shouldn't we clear the cache once m_pendingRequests is empty, then?

Otherwise any other WarningYesNoCancel coming up later from the slave, would 
never show up -- not only in the case of the loop above, but also for any 
other, different, question coming up later in that slave.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list