diff options
| author | Tom Yu <tlyu@mit.edu> | 2011-12-12 20:45:55 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2011-12-12 20:45:55 +0000 |
| commit | 5475caa3bb52e96ed07a67004b5ce9943785a3e4 (patch) | |
| tree | 14a879e9afd8a12f024edf0f643507cd3ae3d9b7 /src/windows/leash/LeashView.cpp | |
| parent | ef6d0436ffaf224bcbc81ceee7fc91416d8b5f3c (diff) | |
| download | krb5-5475caa3bb52e96ed07a67004b5ce9943785a3e4.tar.gz krb5-5475caa3bb52e96ed07a67004b5ce9943785a3e4.tar.xz krb5-5475caa3bb52e96ed07a67004b5ce9943785a3e4.zip | |
kfw fix: restructure low ticket warning popup code to workaround mfc bug
mfc bug causes assertions when dialog is generated from
within PreTranslateMessages() (MSG input param points to a global
variable which is corrupted in the dialog message loop). So we need
to instead PostMessage() to cause the popup later.
Also fixed logic to cause warning dialog to actually be modal as intended
when the leash window is not minimized.
Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
ticket: 7050
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25561 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/leash/LeashView.cpp')
| -rw-r--r-- | src/windows/leash/LeashView.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp index c16feeff1..1b67937c5 100644 --- a/src/windows/leash/LeashView.cpp +++ b/src/windows/leash/LeashView.cpp @@ -44,6 +44,7 @@ IMPLEMENT_DYNCREATE(CLeashView, CFormView) BEGIN_MESSAGE_MAP(CLeashView, CFormView) //{{AFX_MSG_MAP(CLeashView) + ON_MESSAGE(WM_WARNINGPOPUP, OnWarningPopup) ON_MESSAGE(WM_GOODBYE, OnGoodbye) ON_MESSAGE(WM_TRAYICON, OnTrayIcon) ON_NOTIFY(TVN_ITEMEXPANDED, IDC_TREEVIEW, OnItemexpandedTreeview) @@ -172,7 +173,7 @@ CFormView(CLeashView::IDD) m_publicIPAddress = 0; m_autoRenewTickets = 0; m_autoRenewalAttempted = 0; - + m_pWarningMessage = NULL; m_bIconAdded = FALSE; m_bIconDeleted = FALSE; #ifndef KRB5_TC_NOTICKET @@ -2073,6 +2074,27 @@ void CLeashView::SetTrayIcon(int nim, int state) m_bIconDeleted = TRUE; } +BOOL CLeashView::PostWarningMessage(const CString& message) +{ + if (m_pWarningMessage) + { + return FALSE; // can't post more than one warning at a time + } + m_pWarningMessage = new CString(message); + PostMessage(WM_WARNINGPOPUP); + return TRUE; +} + +LRESULT CLeashView::OnWarningPopup(WPARAM wParam, LPARAM lParam) +{ + CLeashMessageBox leashMessageBox(CMainFrame::m_isMinimum ? GetDesktopWindow() : NULL, + *m_pWarningMessage, 100000); + leashMessageBox.DoModal(); + delete m_pWarningMessage; + m_pWarningMessage = NULL; + return 0L; +} + BOOL CLeashView::PreTranslateMessage(MSG* pMsg) { if ( pMsg->message == ID_OBTAIN_TGT_WITH_LPARAM ) @@ -2464,9 +2486,7 @@ BOOL CLeashView::PreTranslateMessage(MSG* pMsg) ReleaseMutex(ticketinfo.lockObj); AlarmBeep(); - CLeashMessageBox leashMessageBox(!CMainFrame::m_isMinimum ? GetDesktopWindow() : NULL, - lowTicketWarning, 100000); - leashMessageBox.DoModal(); + PostWarningMessage(lowTicketWarning); if (WaitForSingleObject( ticketinfo.lockObj, 100 ) != WAIT_OBJECT_0) throw("Unable to lock ticketinfo"); } |
