|
|
commit 75211977b2e6b227db9d498d8e7e9203e3dbed6e
Author: Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Sat Jun 26 15:44:34 2021 +0200
Commit: Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Sat Jun 26 15:48:13 2021 +0200
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...
src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index e47a901..c935b7f 100644
--- src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ 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();
[ Direct Link to Message ] | |
|
| |