]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Fix program not quitting, close #1084
authorCheng Zhao <zcbenz@gmail.com>
Tue, 3 Feb 2015 00:09:35 +0000 (16:09 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 3 Feb 2015 00:10:48 +0000 (16:10 -0800)
atom/common/asar/scoped_temporary_file.cc

index 76ae5cb94b1cace664c2daeb445c73378facbeb7..d7e4dabb9db7f0b5a5a9cb69291af139ab8a7b11 100644 (file)
@@ -16,8 +16,14 @@ ScopedTemporaryFile::ScopedTemporaryFile() {
 
 ScopedTemporaryFile::~ScopedTemporaryFile() {
   if (!path_.empty()) {
+    // On Windows calling base::DeleteFile on exit will call an API that would
+    // halt the program, so we have to call the win32 API directly.
+#if defined(OS_WIN)
+    ::DeleteFile(path_.value().c_str());
+#else
     base::ThreadRestrictions::ScopedAllowIO allow_io;
     base::DeleteFile(path_, false);
+#endif
   }
 }