diff --git a/CHANGELOG.md b/CHANGELOG.md index 456f8baa6..16846323a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ Releases are listed in reverse version number order. > Note that _CodeSnip_ v4 was developed in parallel with v3 for a while. As a consequence some v3 releases have later release dates than early v4 releases. +## Release v4.24.2 of 14 April 2025 + +Hotfix release. + +* Updated bug fix implemented in v4.24.1 to avoid relying on a potentially problematic windows event [issue #70 (2nd attempt)]. +* Corrected release date error for v4.24.1 in `CHANGELOG.md`. + +## Release v4.24.1 of 13 April 2025 + +* Fixed bug where CodeSnip occasionally crashes after a computer resumes from hibernation [issue #70]. +* Bumped some copyright dates for 2025. + ## Release v4.24.0 of 23 October 2024 * Compilers with which a snippet has not been tested are now omitted from snippet information that is copied to the clipboard and included in print outs [issue #143]. diff --git a/Docs/License.html b/Docs/License.html index 458ab8f79..c47a44323 100644 --- a/Docs/License.html +++ b/Docs/License.html @@ -1,7 +1,7 @@  @@ -27,7 +27,7 @@

Summary of End User License Agreement

- DelphiDabbler CodeSnip is copyright © 2005-2024 by Peter D + DelphiDabbler CodeSnip is copyright © 2005-2025 by Peter D Johnson, Restore expand / collapse state of treeview to last save /// state. procedure RestoreTreeState; + ///

!! HACK: Sets an event handler on the tree view to work + /// around a bug that can occur after resuming from hibernation. + procedure _HACK_SetHibernateHandler(const AHandler: TNotifyEvent); end; type diff --git a/Src/UMainDisplayMgr.pas b/Src/UMainDisplayMgr.pas index e9c1f5459..0c64a17d5 100644 --- a/Src/UMainDisplayMgr.pas +++ b/Src/UMainDisplayMgr.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2005-2021, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2005-2025, Peter Johnson (gravatar.com/delphidabbler). * * Class that manages and co-ordinates the display of the program's main UI. * Calls into subsidiary manager objects to perform display operations. @@ -165,6 +165,11 @@ TMainDisplayMgr = class(TObject) procedure DisplayViewItem(ViewItem: IView; Mode: TDetailPageDisplayMode); overload; + /// !! HACK event handle to redisplay the overview pane treeview. + /// Called only if Windows has mysteriously recreated the treeview and lost + /// necessary object references. + procedure _HACK_HibernateHandler(Sender: TObject); + public /// Object contructor. Sets up object to work with given frame /// manager objects. @@ -291,6 +296,14 @@ TMainDisplayMgr = class(TObject) /// Prepares display ready for database to be reloaded. procedure PrepareForDBReload; + + /// !!HACK: gets the overview frame prepared for program + /// hibernation. + /// Saves the overview tree view state ready for restoring after + /// hibernation if Windows has recreated the overview pane's treeview, + /// losing necessary IView object references.. + procedure _HACK_PrepareForHibernate; + end; @@ -691,5 +704,21 @@ procedure TMainDisplayMgr.UpdateOverviewTreeState(const State: TTreeNodeAction); (fOverviewMgr as IOverviewDisplayMgr).UpdateTreeState(State); end; +procedure TMainDisplayMgr._HACK_HibernateHandler(Sender: TObject); +begin + (fOverviewMgr as IOverviewDisplayMgr).Display(Query.Selection, True); + (fOverviewMgr as IOverviewDisplayMgr).RestoreTreeState; + // disable this handler until next resume from hibernation + (fOverviewMgr as IOverviewDisplayMgr)._HACK_SetHibernateHandler(nil); +end; + +procedure TMainDisplayMgr._HACK_PrepareForHibernate; +begin + (fOverviewMgr as IOverviewDisplayMgr).SaveTreeState; + (fOverviewMgr as IOverviewDisplayMgr)._HACK_SetHibernateHandler( + _HACK_HibernateHandler + ); +end; + end. diff --git a/Src/VersionInfo.vi-inc b/Src/VersionInfo.vi-inc index 70615f76f..fbd558db1 100644 --- a/Src/VersionInfo.vi-inc +++ b/Src/VersionInfo.vi-inc @@ -1,8 +1,8 @@ # CodeSnip Version Information Macros for Including in .vi files # Version & build numbers -version=4.24.0 -build=272 +version=4.24.2 +build=274 # String file information copyright=Copyright © P.D.Johnson, 2005-.