OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" | 7 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" |
8 | 8 |
9 #include "fpdfsdk/fxedit/include/fxet_edit.h" | 9 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
10 #include "fpdfsdk/fxedit/include/fxet_list.h" | 10 #include "fpdfsdk/fxedit/include/fxet_list.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 SetHoverSel(HasFlag(PLBS_HOVERSEL)); | 88 SetHoverSel(HasFlag(PLBS_HOVERSEL)); |
89 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); | 89 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); |
90 m_pList->SetFontSize(GetCreationParam().fFontSize); | 90 m_pList->SetFontSize(GetCreationParam().fFontSize); |
91 | 91 |
92 m_bHoverSel = HasFlag(PLBS_HOVERSEL); | 92 m_bHoverSel = HasFlag(PLBS_HOVERSEL); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 void CPWL_ListBox::OnDestroy() { | 96 void CPWL_ListBox::OnDestroy() { |
| 97 // Make sure the notifier is removed from the list as we are about to |
| 98 // destroy the notifier and don't want to leave a dangling pointer. |
| 99 if (m_pList) |
| 100 m_pList->SetNotify(nullptr); |
97 m_pListNotify.reset(); | 101 m_pListNotify.reset(); |
98 } | 102 } |
99 | 103 |
100 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 104 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
101 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 105 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
102 | 106 |
103 CFX_ByteTextBuf sListItems; | 107 CFX_ByteTextBuf sListItems; |
104 | 108 |
105 if (m_pList) { | 109 if (m_pList) { |
106 CFX_FloatRect rcPlate = m_pList->GetPlateRect(); | 110 CFX_FloatRect rcPlate = m_pList->GetPlateRect(); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (zDelta < 0) { | 526 if (zDelta < 0) { |
523 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 527 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
524 } else { | 528 } else { |
525 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 529 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
526 } | 530 } |
527 | 531 |
528 FX_BOOL bExit = FALSE; | 532 FX_BOOL bExit = FALSE; |
529 OnNotifySelChanged(FALSE, bExit, nFlag); | 533 OnNotifySelChanged(FALSE, bExit, nFlag); |
530 return TRUE; | 534 return TRUE; |
531 } | 535 } |
OLD | NEW |