Title: [156344] trunk/Source/WebKit/win
- Revision
- 156344
- Author
- [email protected]
- Date
- 2013-09-24 11:42:05 -0700 (Tue, 24 Sep 2013)
Log Message
[Windows] Unreviewed crash fix after r156321.
Fix a few mistakes in the use of Vectors and counting that introduced test crashes.
* WebHistory.cpp:
(WebHistory::removeAllItems): Loop termination tried to test an unsigned for negative size.
(WebHistory::removeItemFromDateCaches): Vector was being created with empty entries.
(WebHistory::addItemToDateCaches): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebKit/win/ChangeLog (156343 => 156344)
--- trunk/Source/WebKit/win/ChangeLog 2013-09-24 18:38:49 UTC (rev 156343)
+++ trunk/Source/WebKit/win/ChangeLog 2013-09-24 18:42:05 UTC (rev 156344)
@@ -1,3 +1,14 @@
+2013-09-24 Brent Fulgham <[email protected]>
+
+ [Windows] Unreviewed crash fix after r156321.
+
+ Fix a few mistakes in the use of Vectors and counting that introduced test crashes.
+
+ * WebHistory.cpp:
+ (WebHistory::removeAllItems): Loop termination tried to test an unsigned for negative size.
+ (WebHistory::removeItemFromDateCaches): Vector was being created with empty entries.
+ (WebHistory::addItemToDateCaches): Ditto.
+
2013-09-24 Patrick Gansterer <[email protected]>
Make WebHistory more type safe
Modified: trunk/Source/WebKit/win/WebHistory.cpp (156343 => 156344)
--- trunk/Source/WebKit/win/WebHistory.cpp 2013-09-24 18:38:49 UTC (rev 156343)
+++ trunk/Source/WebKit/win/WebHistory.cpp 2013-09-24 18:42:05 UTC (rev 156344)
@@ -271,7 +271,8 @@
m_entriesByDate.clear();
m_orderedLastVisitedDays = nullptr;
- Vector<IWebHistoryItem*> itemsVector(m_entriesByURL.size());
+ Vector<IWebHistoryItem*> itemsVector;
+ itemsVector.reserveInitialCapacity(m_entriesByURL.size());
for (auto it = m_entriesByURL.begin(); it != m_entriesByURL.end(); ++it)
itemsVector.append(it->value.get());
RetainPtr<CFArrayRef> allItems = adoptCF(CFArrayCreate(kCFAllocatorDefault, (const void**)itemsVector.data(), itemsVector.size(), &MarshallingHelpers::kIUnknownArrayCallBacks));
@@ -595,9 +596,9 @@
return S_OK;
auto& entriesForDate = found->value;
- size_t count = entriesForDate.size();
+ int count = entriesForDate.size();
- for (size_t i = count - 1; i >= 0; --i) {
+ for (int i = count - 1; i >= 0; --i) {
if (entriesForDate[i] == entry)
entriesForDate.remove(i);
}
@@ -622,7 +623,7 @@
DateKey key = dateKey(lastVisitedTime);
auto found = m_entriesByDate.find(key);
if (found == m_entriesByDate.end()) {
- Vector<COMPtr<IWebHistoryItem>> entries(1);
+ Vector<COMPtr<IWebHistoryItem>> entries;
entries.append(entry);
m_entriesByDate.set(key, entries);
// Clear m_orderedLastVisitedDays so it will be regenerated when next requested.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes