FolderSize: Add context menu in the Files and File Types list views
Borland's Object Windows Library for the modern age
Brought to you by:
jogybl,
sebas_ledesma
Nice! I've reviewed [r5939] and applied a simplification in [r5947], eliminating unnecessary use of dynamic allocation and pointers for the menu item icons.
Note that TBitmap is a HBITMAP handle encapsulation. Pointer-to-handle is usually unnecessary indirection. Dynamic allocation and pointers have traditionally been overused in OWL, although for TBitmap, indirection may make sense to avoid the unconventional copy-constructor and its deep-copy semantics. But with modern C++, the copy constructor can be avoided, and hence make indirection unnecessary.
Related
Commit: [r5939]
Commit: [r5947]
Hi @jogybl,
Note that since the implementation of "Menu bitmap ownership handling" [feature-requests:#262], menus now own their bitmap handles. FolderSize's main menu has been updated for the new ownership model (TMainWindow::GetMenuDescriptor), but the context menus have not (e.g. TFilesListContextMenu). The context menus still keep TBitmap instances to the menu bitmaps, causing double deletion of the bitmap handles.
While, it seems the double deletion has been harmless, you can simply remove the data members holding TBitmap instances. Instead, create the TBitmap instances locally with the NoAutoDelete flag, just like the GetMenuDescriptor implementations.
PS. All other uses of SetMenuItemBitmaps throughout the examples seem to have been updated. OWLMaker has been updated as well.
Related
Feature Requests: #262
RGR: FolderSize: Copy-and-paste error in throw-statements [r8735].
Related
Commit: [r8735]