diff options
author | Julian Eisel <julian@blender.org> | 2021-11-04 14:10:58 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-04 14:20:37 +0300 |
commit | 80a46955d8212f01b77215ab12d479d934e305f4 (patch) | |
tree | 538ddd4b47c195df8006456c046d6dce6bad1a20 /source/blender/editors/interface/interface_dropboxes.cc | |
parent | bfb664b65de2c71ee3d85760ee5dcf83a7c9aa23 (diff) |
Fix T92501: Crash when dragging material assets over 3D View regions
Issue was that the context used for dropbox handling and polling didn't
match the one used for drawing the dropbox and generating the tooltip
text (which would determine the material slot under the cursor,
requiring context). The mismatch would happen with overlapping regions.
Actually, this patch includes two fixes, each fixing the crash itself:
* Store the context from handling & polling and restore it for drawing.
* Correct the hovered region lookup for drawing to account for overlayed
regions.
Note that to properly set up context for drawing, we should also account
for the operator context, which isn't done here, see
https://developer.blender.org/T92501#1247581.
Diffstat (limited to 'source/blender/editors/interface/interface_dropboxes.cc')
-rw-r--r-- | source/blender/editors/interface/interface_dropboxes.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_dropboxes.cc b/source/blender/editors/interface/interface_dropboxes.cc index 81a1354cbe7..369efa7c52e 100644 --- a/source/blender/editors/interface/interface_dropboxes.cc +++ b/source/blender/editors/interface/interface_dropboxes.cc @@ -39,12 +39,12 @@ static bool ui_tree_view_drop_poll(bContext *C, wmDrag *drag, const wmEvent *eve return false; } - if (drag->free_disabled_info) { - MEM_SAFE_FREE(drag->disabled_info); + if (drag->drop_state.free_disabled_info) { + MEM_SAFE_FREE(drag->drop_state.disabled_info); } - drag->free_disabled_info = false; - return UI_tree_view_item_can_drop(hovered_tree_item, drag, &drag->disabled_info); + drag->drop_state.free_disabled_info = false; + return UI_tree_view_item_can_drop(hovered_tree_item, drag, &drag->drop_state.disabled_info); } static char *ui_tree_view_drop_tooltip(bContext *C, |