Fix crashes for some operators poll functions in background mode
This commit is contained in:
@@ -2383,13 +2383,16 @@ static void UI_OT_list_start_filter(wmOperatorType *ot)
|
||||
|
||||
static bool ui_view_focused_poll(bContext *C)
|
||||
{
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
if (!(win && win->eventstate)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
if (!region) {
|
||||
return false;
|
||||
}
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
const uiViewHandle *view = UI_region_view_find_at(region, win->eventstate->xy, 0);
|
||||
|
||||
return view != nullptr;
|
||||
}
|
||||
|
||||
@@ -2426,6 +2429,9 @@ static void UI_OT_view_start_filter(wmOperatorType *ot)
|
||||
static bool ui_view_drop_poll(bContext *C)
|
||||
{
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
if (!(win && win->eventstate)) {
|
||||
return false;
|
||||
}
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
if (region == nullptr) {
|
||||
return false;
|
||||
|
||||
@@ -1868,17 +1868,17 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
|
||||
|
||||
static bool scroller_activate_poll(bContext *C)
|
||||
{
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
if (!(win && win->eventstate)) {
|
||||
return false;
|
||||
}
|
||||
if (!view2d_poll(C)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
View2D *v2d = ®ion->v2d;
|
||||
wmEvent *event = win->eventstate;
|
||||
|
||||
/* Check if mouse in scroll-bars, if they're enabled. */
|
||||
return (UI_view2d_mouse_in_scrollers(region, v2d, event->xy) != 0);
|
||||
return (UI_view2d_mouse_in_scrollers(region, v2d, win->eventstate->xy) != 0);
|
||||
}
|
||||
|
||||
/* Initialize #wmOperator.customdata for scroller manipulation operator. */
|
||||
|
||||
Reference in New Issue
Block a user