-
Notifications
You must be signed in to change notification settings - Fork 35
Commit ca42523
committed
Revise hibernate bug fix (issue #70)
Following a discussion in the comments the DelphiDabbler Blog post at
https://tinyurl.com/mrp76mdy it seems that was not a good idea to rely
upon handling WM_POWERBROADCAST's PBT_APMPOWERSTATUSCHANGE event to
restore the overview pane's tree view nodes to the expected state after
Windows has recreated the tree view in an invalid state.
So I've modified the code to only rely on the PBT_APMSUSPEND event of
WM_POWERBROADCAST and not PBT_APMPOWERSTATUSCHANGE. PBT_APMSUSPEND is
handled to prepare for hibernation by not only saving the tree view's
state (as per the previous fix) but also setting an event handler that
gets called only when the tree view's window gets recreated by Windows
AND the treeview contains nodes with nil IView pointers. When called,
the event handler rebuilds the tree view with nodes containing valid
IView references.
The problem is that the event needs to be triggered from the
TTreeView.CreateWnd method that gets called when Windows recreates the
tree view. Since TTreeView exposes no suitable events, the only way is
to inject a suitable event using a nasty hack. Not good practise.
Note that all the methods that depend on the hack have been given names
beginning with "_HACK_" to make it obvious where the naughtiness lies.1 parent e5c0ce6 commit ca42523
File tree
4 files changed
+87
-33
lines changed- Src
4 files changed
+87
-33
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
524 | 524 |
| |
525 | 525 |
| |
526 | 526 |
| |
527 | - | ||
527 | + | ||
528 | 528 |
| |
529 | 529 |
| |
530 | + | ||
530 | 531 |
| |
531 | 532 |
| |
532 | 533 |
| |
| |||
1587 | 1588 |
| |
1588 | 1589 |
| |
1589 | 1590 |
| |
1591 | + | ||
1590 | 1592 |
| |
1591 | 1593 |
| |
1592 | 1594 |
| |
1593 | 1595 |
| |
1594 | 1596 |
| |
1595 | 1597 |
| |
1596 | 1598 |
| |
1597 | - | ||
1598 | - | ||
1599 | - | ||
1600 | - | ||
1601 | - | ||
1599 | + | ||
1602 | 1600 |
| |
1603 | 1601 |
| |
1604 | 1602 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
29 | 52 |
| |
30 | 53 |
| |
31 | 54 |
| |
| |||
214 | 237 |
| |
215 | 238 |
| |
216 | 239 |
| |
240 | + | ||
241 | + | ||
242 | + | ||
243 | + | ||
217 | 244 |
| |
218 | 245 |
| |
219 | 246 |
| |
| |||
955 | 982 |
| |
956 | 983 |
| |
957 | 984 |
| |
985 | + | ||
986 | + | ||
987 | + | ||
988 | + | ||
989 | + | ||
990 | + | ||
958 | 991 |
| |
959 | 992 |
| |
960 | 993 |
| |
| |||
993 | 1026 |
| |
994 | 1027 |
| |
995 | 1028 |
| |
1029 | + | ||
1030 | + | ||
1031 | + | ||
1032 | + | ||
1033 | + | ||
1034 | + | ||
1035 | + | ||
1036 | + | ||
1037 | + | ||
1038 | + | ||
1039 | + | ||
1040 | + | ||
1041 | + | ||
1042 | + | ||
1043 | + | ||
1044 | + | ||
1045 | + | ||
1046 | + | ||
1047 | + | ||
996 | 1048 |
| |
997 | 1049 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
6 | + | ||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | + | ||
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
| |||
145 | 146 |
| |
146 | 147 |
| |
147 | 148 |
| |
149 | + | ||
150 | + | ||
151 | + | ||
148 | 152 |
| |
149 | 153 |
| |
150 | 154 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | ||
168 | 173 |
| |
169 | 174 |
| |
170 | 175 |
| |
| |||
292 | 297 |
| |
293 | 298 |
| |
294 | 299 |
| |
295 | - | ||
296 | - | ||
300 | + | ||
301 | + | ||
297 | 302 |
| |
298 | - | ||
299 | - | ||
300 | - | ||
301 | - | ||
302 | - | ||
303 | - | ||
304 | - | ||
305 | - | ||
306 | - | ||
307 | - | ||
308 | - | ||
309 | - | ||
303 | + | ||
304 | + | ||
305 | + | ||
310 | 306 |
| |
311 | 307 |
| |
312 | 308 |
| |
| |||
583 | 579 |
| |
584 | 580 |
| |
585 | 581 |
| |
586 | - | ||
587 | - | ||
588 | - | ||
589 | - | ||
590 | - | ||
591 | - | ||
592 | 582 |
| |
593 | 583 |
| |
594 | 584 |
| |
| |||
616 | 606 |
| |
617 | 607 |
| |
618 | 608 |
| |
619 | - | ||
620 | - | ||
621 | - | ||
622 | - | ||
623 | - | ||
624 | - | ||
625 | 609 |
| |
626 | 610 |
| |
627 | 611 |
| |
| |||
720 | 704 |
| |
721 | 705 |
| |
722 | 706 |
| |
707 | + | ||
708 | + | ||
709 | + | ||
710 | + | ||
711 | + | ||
712 | + | ||
713 | + | ||
714 | + | ||
715 | + | ||
716 | + | ||
717 | + | ||
718 | + | ||
719 | + | ||
720 | + | ||
721 | + | ||
722 | + | ||
723 | 723 |
| |
724 | 724 |
|
0 commit comments