summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-06-26 15:44:34 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-06-26 15:48:13 +0200
commit75211977b2e6b227db9d498d8e7e9203e3dbed6e (patch)
tree0588218dbca46212a6ad9d4fe8f7bfff28482ae0
parentc21732705cf6fe4e456a377374f4b7d472231638 (diff)
Fix a potential memory leak (PR #241)
This is a hypothetical fix, since the condition `count == 0` may not be true although `doit` has been allocated. In practice this should not be possible since the same loop is executed twice in lines 463++ and 471++. But anyway, here it is...
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index e47a901be..c935b7f4c 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -1,7 +1,7 @@
//
// Definition of Apple Cocoa window driver.
//
-// Copyright 1998-2020 by Bill Spitzak and others.
+// Copyright 1998-2021 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -481,7 +481,7 @@ void Fl_WinAPI_Window_Driver::hide() {
}
// make sure any custom icons get freed
-// icons(NULL, 0); // free_icons() is called by the Fl_Window destructor
+ // icons(NULL, 0); // free_icons() is called by the Fl_Window destructor
// this little trick keeps the current clipboard alive, even if we are about
// to destroy the window that owns the selection.
if (GetClipboardOwner()==ip->xid)
@@ -517,8 +517,9 @@ void Fl_WinAPI_Window_Driver::hide() {
if (ii != 0) doit[0]->show(); // Fix for STR#3165
doit[ii]->show();
}
- delete[] doit;
}
+ delete[] doit; // note: `count` and `doit` may be NULL (see PR #241)
+
// Try to stop the annoying "raise another program" behavior
if (pWindow->non_modal() && Fl::first_window() && Fl::first_window()->shown())
Fl::first_window()->show();