Antonio Scuri <antonio.sc...@gmail.com>于2018年2月23日周五 上午12:56写道：
> I run the sample here in debug, and with the release version, but the
> problem did not appeared. I understand you are rebuilding the tree during a
> double click. This is what you are doing in your program too or just a
> test? I wouldn't recommend that.
I build iup by mingw64 (with my own makefile), but I guess it's related to
windows version . I use windows 10 64bit (1709/16299.192)
My program is complex than the test I posted. I want to map a file system
to a tree control like editplus (https://www.editplus.com/)
Only one branch can be expanded. (See
If you double click 'Public' , 'Document' will collapsed and the branch
removed , and `Public` folder will be expaned like :
So I need remove some items and add some new one here. Rebuilding may be a
easy way to do that.
> Anyway, I think we may test for a valid item there, but I don't think
> that every call to GETITEM should be tested and simply return doing
I agree, but I think we should check it here at least .
This patch can fix my problem:
--- src/win/iupwin_tree.c (版本 4683)
+++ src/win/iupwin_tree.c (工作副本)
@@ -811,7 +811,8 @@
/* Get Children: branch or leaf */
item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_STATE;
item.hItem = hItem;
- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
+ if (!SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item))
+ return IUP_IGNORE;
itemData = (winTreeItemData*)item.lParam;
if (itemData->kind == ITREE_BRANCH)
If we found the Item is invalid, return IUP_IGNORE. It's call by
else if(msg_info->code == TVN_ITEMEXPANDING)
/* mouse click by user: click on the "+" sign or double click on the
selected node */
NMTREEVIEW* tree_info = (NMTREEVIEW*)msg_info;
HTREEITEM hItem = tree_info->itemNew.hItem;
if (winTreeCallBranchLeafCb(ih, hItem) != IUP_IGNORE)
hItem is get from `msg_info`, it just removed from the tree when the
problem occurs. I guess windows put the `WM_NOTIFY` message into message
queue first, and then the items removed, but the message is still in the
windows message queue.
> Is there a way that I can force the sample in a situation that the
> problem would be more likely to occur?
In my sample, I wrote a function do_some_systemcall() to open a file lots
of times, and call this function every time I add or remove tree items.
This can trigger the bug more likely in my environment. (without this
function, the bug is hardly reproduced)
> Which IUP version are you using?
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