Browse Source

Memory leak in progress window in command-line run

Source commit: daef43d38702def4b153dc5cbad54e8243931d77
Martin Prikryl 9 years ago
parent
commit
e73cfb66da
1 changed files with 4 additions and 0 deletions
  1. 4 0
      source/forms/Progress.cpp

+ 4 - 0
source/forms/Progress.cpp

@@ -434,6 +434,10 @@ void __fastcall TProgressForm::FormShow(TObject * /*Sender*/)
   {
   {
     UpdateControls();
     UpdateControls();
   }
   }
+  // HACK: In command-line run (/upload), FormShow gets called twice,
+  // leading to duplicate hook and memory leak. Make sure we unhook, just in case.
+  // Calling unhook without hooking first is noop.
+  UnhookFormActivation(this);
   HookFormActivation(this);
   HookFormActivation(this);
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------