PureBasic Forum
http://forums.purebasic.com/english/

[Done] PB 5.72 LTS Beta 2 Qt - CopyImage bug
http://forums.purebasic.com/english/viewtopic.php?f=23&t=74852
Page 1 of 1

Author:  wombats [ Thu Mar 12, 2020 1:09 pm ]
Post subject:  [Done] PB 5.72 LTS Beta 2 Qt - CopyImage bug

There appears to be a problem with CopyImage if the image you are trying to copy has been used as a gadget item image.

It crashes with "Invalid memory access" at the end of the program. Works fine on GTK.
Code:
EnableExplicit

Enumeration
  #Window
  #Tree
  #Canvas
EndEnumeration

Define img, icon

img = CreateImage(#PB_Any, 16, 16, 24)
If StartDrawing(ImageOutput(img))
  Box(0, 0, OutputWidth(), OutputHeight(), RGB(0, 0, 255))
  StopDrawing()
EndIf

OpenWindow(#Window, 0, 0, 320, 240, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

TreeGadget(#Tree, 10, 10, 100, 200)
AddGadgetItem(#Tree, -1, "Item 1", ImageID(img))

icon = CopyImage(img, #PB_Any)
CanvasGadget(#Canvas, 120, 10, 50, 50)
If StartDrawing(CanvasOutput(#Canvas))
  DrawImage(ImageID(icon), 10, 10)
  StopDrawing()
EndIf
FreeImage(icon)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Author:  Fred [ Tue Nov 17, 2020 3:38 pm ]
Post subject:  Re: [PB 5.72 LTS Beta 2 Qt] - CopyImage bug

Fixed.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/