Hi,

 I'm on vacation. I'll be back on mid February.

  Thanks for reporting anyway.

Best,
Scuri


Em 9 de fev de 2018 9:09 AM, "云风 Cloud Wu" <clou...@gmail.com> escreveu:

> I found a bug can crash the program today. It crash in
>
> static int winTreeCallBranchLeafCb(Ihandle* ih, HTREEITEM hItem)
>  @iupwin_tree.c
>
>   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
>   itemData = (winTreeItemData*)item.lParam;
>   if (itemData->kind == ITREE_BRANCH)
>
> SendMessage may return false, and itemData  will be NULL .
>
> It may caused by delete nodes in `executeleaf_cb` .
>
> It seems that windows may push a notify message before an item deleted,
> and then it recv this message, but the item is gone.
>
> I try to make a minimal working example , but it doesn't work every time.
>
> -------
> local tree = iup.tree {
> HIDEBUTTONS = "yes",
> HIDELINES = "yes",
> }
>
> local dlg = iup.dialog {
> tree,
> margin = "4x4",
> size = "HALFxHALF",
> shrink="yes",
> title = "Shader Compiler",
> }
>
> local function do_some_systemcall()
> for i=1,100 do
>                 -- c:\\windows\\win.ini should be exist.
> local f = io.open("c:\\windows\\win.ini","rb")
> if f then
> f:close()
> end
> end
> end
>
> local function rebuild_tree(flag, id)
> tree.delnode0 = "CHILDREN"
> tree.title0 = "foobar"
> if flag then
> tree.addbranch0 = "xxx"
> tree.value = 1
> do_some_systemcall()
> for i=1,3 do
> tree.addleaf1 = "xxx"
> tree.image2 = "IMGCOLLAPSED"
> end
> do_some_systemcall()
> else
> tree.addleaf0 = "Click Me (may crash)"
> tree.image1 = "IMGCOLLAPSED"
> for i=0,3 do
> do_some_systemcall()
> tree.addleaf0 = "xxx"
> tree.image1 = "IMGCOLLAPSED"
> end
> tree.value = id
> end
>
> function tree:executeleaf_cb(id)
> rebuild_tree(not flag, id)
> end
>
> function tree:branchclose_cb(id)
> rebuild_tree(not flag, id)
> return iup.IGNORE
> end
> end
>
> dlg:showxy(iup.CENTER,iup.CENTER)
>
> rebuild_tree(false)
>
> iup.MainLoop()
> iup.Close()
> -------
>
> Run this program, and click the last item (named "Click Me") , it may
> crash on windows 10 64bit (1709/16299.192) .
>
> I think we should check the result of  `SendMessage(ih->handle,
> TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item)` to fix it, or it there a better
> way ?
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to