pureDispHelper & nBit control crash on release object

Windows specific forum
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

pureDispHelper & nBit control crash on release object

Post by Dare »

Hi.

I am trying the demo version of the http://www.nbit.net.au HTML editor with pureDispHelper.

This crashes with "invalid memory access" on dhReleaseObject.

Code: Select all

dhToggleExceptions(#True)
OpenWindow(1, 0,0, 800,600, "Test")
CreateGadgetList(WindowID(1))
ContainerGadget(1,10,10,600,300)
CloseGadgetList()
;         oEd = dhCreateObject("rmpHTML.HTMLEd", WindowID(1)) ; Okay, but fills window
oEd = dhCreateObject("rmpHTML.HTMLEd", GadgetID(1))  ; Okay
Debug oEd
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
dhReleaseObject(oEd) ; Crash if windowID or gadgetID used in dhCreateObject
                     ; --  Invalid Memory Access --
                     ; Crashes on first internal IDE comment line following this line.
                     ; so assume it is this line
If I don't use the windowID or gadgetID in createobject, it fails to load.
If I do use either, it loads and is editable but crashes with "invalid memory access" on release.

Also:
No errors are reported but setting/getting properties fails (just doesn't happen). Eg:

Code: Select all

w.s="<div>abc</div>"
dhPutValue(oEd, ".DocumentHTML = %s", @w)
I am obviously missing some major point here.

Can anyone help?




Aside and on another note altogether. How do you pass a word (2 byte integer) value in dhPutValue? ("%w" is not recognised).
Dare2 cut down to size
LuckyLuke
Enthusiast
Enthusiast
Posts: 181
Joined: Fri Jun 06, 2003 2:41 pm
Location: Belgium

Post by LuckyLuke »

Using the OCX_CreateGadget() function works fine.

Code: Select all

oEd = OCX_CreateGadget(2, 10, 10, 600, 300, "rmpHTML.HTMLEd")
Regards,

LuckyLuke
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Ah!

Thank you!


(With OCX/COM and PureBasic I feel like I am running along a narrow beam '000s of ks above the ground - with my eyes closed on a pitch black night)


EEEEeeeeeeeyyyYYAAAAaaaaaa.
Dare2 cut down to size
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Or you should close your window before program end, see the examples,
always CloseWindow(0) before end :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Ah yes. That also fixes it.

My bad there. Thanks!



This works quite nicely now with the OCX_CreateGadget function.


I sometimes get a "invalid memory address" error in the waitwindowevent loop after editing table properties but I think that might be the control not releasing the table and contents and so PB is suddenly given an unknown gadget (the table). Guessing.

But we advance.

Thanks again.
Dare2 cut down to size
Post Reply