Module: WinGUI::Util::ScopedStruct
- Included in:
- ACCEL, ACTCTX, CREATESTRUCT, LOGBRUSH, LOGFONT, LOGPEN, MENUITEMINFO, MINMAXINFO, MSG, NMHDR, NONCLIENTMETRICS, OSVERSIONINFOEX, PAINTSTRUCT, POINT, RECT, SIZE, STYLESTRUCT, WINDOWPOS, WNDCLASSEX
- Defined in:
- lib/ffi-wingui-core.rb
Instance Method Summary collapse
Instance Method Details
#new(*args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ffi-wingui-core.rb', line 42 def new(*args) raise ArgumentError, 'Cannot accept both arguments and a block' if args.length > 0 && block_given? struct = super return struct unless block_given? begin yield struct ensure struct.pointer.free p "Native memory for #{struct} freed" if $DEBUG end nil end |