Changeset 26376 in webkit
- Timestamp:
- Oct 11, 2007 5:16:56 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r26374 r26376 1 2007-10-11 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Reviewed by Anders. 4 5 Handle a race condition that could arise if a plugin was loaded while it 6 was scheduled to be freed: check whether the timer that schedules 7 library frees is active in PluginPackageWin::load(). 8 9 * plugins/win/PluginPackageWin.cpp: 10 (WebCore::PluginPackageWin::freeLibrarySoon): Added assertions 11 (WebCore::PluginPackageWin::freeLibraryTimerFired): Added assertion 12 (WebCore::PluginPackageWin::load): If we are scheduled to free this 13 library, cancel the timer, and don't call LoadLibrary 14 1 15 2007-10-11 Justin Garcia <justin.garcia@apple.com> 2 16 -
trunk/WebCore/plugins/win/PluginPackageWin.cpp
r26364 r26376 84 84 void PluginPackageWin::freeLibrarySoon() 85 85 { 86 ASSERT(!m_freeLibraryTimer.isActive()); 87 ASSERT(m_module); 88 ASSERT(m_loadCount == 0); 89 86 90 m_freeLibraryTimer.startOneShot(0); 87 91 } … … 90 94 { 91 95 ASSERT(m_module); 92 93 FreeLibrary(m_module); 96 ASSERT(m_loadCount == 0); 97 98 ::FreeLibrary(m_module); 94 99 m_module = 0; 95 100 } … … 158 163 bool PluginPackageWin::load() 159 164 { 160 if (m_isLoaded) { 165 if (m_freeLibraryTimer.isActive()) { 166 ASSERT(m_module); 167 m_freeLibraryTimer.stop(); 168 } else if (m_isLoaded) { 161 169 m_loadCount++; 162 170 return true; 163 } 164 165 WCHAR currentPath[MAX_PATH]; 166 167 if (!::GetCurrentDirectoryW(MAX_PATH, currentPath))168 return false; 169 170 String path = m_path.substring(0, m_path.reverseFind('\\')); 171 172 if (!::SetCurrentDirectoryW(path.charactersWithNullTermination()))173 return false; 174 175 // Load the library176 m_module = ::LoadLibraryW(m_path.charactersWithNullTermination()); 177 178 if (!::SetCurrentDirectoryW(currentPath)) {179 if (m_module)180 ::FreeLibrary(m_module);181 return false;171 } else { 172 WCHAR currentPath[MAX_PATH]; 173 174 if (!::GetCurrentDirectoryW(MAX_PATH, currentPath)) 175 return false; 176 177 String path = m_path.substring(0, m_path.reverseFind('\\')); 178 179 if (!::SetCurrentDirectoryW(path.charactersWithNullTermination())) 180 return false; 181 182 // Load the library 183 m_module = ::LoadLibraryW(m_path.charactersWithNullTermination()); 184 185 if (!::SetCurrentDirectoryW(currentPath)) { 186 if (m_module) 187 ::FreeLibrary(m_module); 188 return false; 189 } 182 190 } 183 191
Note: See TracChangeset
for help on using the changeset viewer.