Commit c481f5e
committed
FileInputType should use WeakPtr for FileListCreator lambdas
https://bugs.webkit.org/show_bug.cgi?id=213130
<rdar://problem/64276591>
Reviewed by David Kilzer.
FileInputType::filesChosen was passing a completion handler to FileListCreator::create that
captured |this|. If the FileListCreator instance still existed when |this| was destroyed,
FileInputType::~FileInputType would clear the captured |this| by calling
FileListCreator::clear. This can be simplified by having the FileListCreator completion
handler capture a WeakPtr to |this|.
Also, when FileInputType::allowsDirectories is false, m_fileListCreator would not be
properly cleared after creating the file list. The FileListCreator completion handler would
set m_fileListCreator to nullptr, but would be executed *before* FileListCreator::create
returned and set m_fileListCreator to the newly-created FileListCreator object. Fixed this
by having FileListCreator::create execute the completion handler immediately and return
nullptr in cases where a FileListCreator does not need to be created for directory
resolution.
Covered by existing tests.
* html/FileInputType.cpp:
(WebCore::FileInputType::~FileInputType):
(WebCore::FileInputType::filesChosen):
* html/FileInputType.h:
* html/FileListCreator.cpp:
(WebCore::createFileList):
(WebCore::FileListCreator::create):
(WebCore::FileListCreator::FileListCreator):
(WebCore::FileListCreator::createFileList):
* html/FileListCreator.h:
(WebCore::FileListCreator::create): Deleted.
Canonical link: https://commits.webkit.org/225916@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262962 268f45cc-cd09-0410-ab3c-d52691b4dbfc1 parent 53f7c03 commit c481f5eCopy full SHA for c481f5e
5 files changed
+77-40Lines changed: 77 additions & 40 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- Source/WebCore
- html
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+36Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
1 | 37 | |
2 | 38 | |
3 | 39 | |
|
Collapse file
Source/WebCore/html/FileInputType.cpp
Copy file name to clipboardExpand all lines: Source/WebCore/html/FileInputType.cpp+5-5Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
| 2 | + |
3 | 3 | |
4 | 4 | |
5 | 5 | |
| ||
103 | 103 | |
104 | 104 | |
105 | 105 | |
106 | | - |
107 | | - |
108 | | - |
109 | 106 | |
110 | 107 | |
111 | 108 | |
| ||
416 | 413 | |
417 | 414 | |
418 | 415 | |
419 | | - |
| 416 | + |
| 417 | + |
| 418 | + |
| 419 | + |
420 | 420 | |
421 | 421 | |
422 | 422 | |
|
Collapse file
Source/WebCore/html/FileInputType.h
Copy file name to clipboardExpand all lines: Source/WebCore/html/FileInputType.h+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | | - |
| 3 | + |
4 | 4 | |
5 | 5 | |
6 | 6 | |
| ||
35 | 35 | |
36 | 36 | |
37 | 37 | |
| 38 | + |
38 | 39 | |
39 | 40 | |
40 | 41 | |
| ||
43 | 44 | |
44 | 45 | |
45 | 46 | |
46 | | - |
| 47 | + |
47 | 48 | |
48 | 49 | |
49 | 50 | |
|
Collapse file
Source/WebCore/html/FileListCreator.cpp
Copy file name to clipboardExpand all lines: Source/WebCore/html/FileListCreator.cpp+29-23Lines changed: 29 additions & 23 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
| 2 | + |
3 | 3 | |
4 | 4 | |
5 | 5 | |
| ||
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | | - |
| 39 | + |
40 | 40 | |
41 | 41 | |
42 | 42 | |
| ||
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | 60 | |
79 | | - |
| 61 | + |
80 | 62 | |
81 | 63 | |
82 | 64 | |
83 | | - |
| 65 | + |
84 | 66 | |
85 | 67 | |
86 | 68 | |
87 | 69 | |
88 | 70 | |
89 | 71 | |
90 | 72 | |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
91 | 97 | |
92 | 98 | |
93 | | - |
| 99 | + |
94 | 100 | |
95 | 101 | |
96 | 102 | |
|
Collapse file
Source/WebCore/html/FileListCreator.h
Copy file name to clipboardExpand all lines: Source/WebCore/html/FileListCreator.h+4-10Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
| 2 | + |
3 | 3 | |
4 | 4 | |
5 | 5 | |
| ||
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
| 44 | + |
48 | 45 | |
49 | 46 | |
50 | 47 | |
51 | 48 | |
52 | 49 | |
53 | 50 | |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
| 51 | + |
58 | 52 | |
59 | 53 | |
60 | | - |
| 54 | + |
61 | 55 | |
62 | 56 | |
63 | 57 | |
0 commit comments