Skip to content

Commit ac46648

Browse files
author
Roberto De Ioris
committed
improved reference counting for delegates callback
1 parent 2fbf288 commit ac46648

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

Source/UnrealEnginePython/Private/Http/UEPyIHttpRequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void FPythonSmartHttpDelegate::OnRequestComplete(FHttpRequestPtr request, FHttpR
154154
return;
155155
}
156156

157-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"OOO", py_http_request, py_ue_new_ihttp_response(response.Get()), successful ? Py_True : Py_False);
157+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"ONO", py_http_request, py_ue_new_ihttp_response(response.Get()), successful ? Py_True : Py_False);
158158
if (!ret)
159159
{
160160
unreal_engine_py_log_error();

Source/UnrealEnginePython/Private/Slate/UEPySPythonMultiColumnTableRow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SPythonMultiColumnTableRow : public SMultiColumnTableRow<TSharedPtr<FPytho
6767
return FReply::Unhandled();
6868
}
6969

70-
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_double_click, (char *)"OO", py_ue_new_fgeometry(InMyGeometry), py_ue_new_fpointer_event(InMouseEvent));
70+
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_double_click, (char *)"NN", py_ue_new_fgeometry(InMyGeometry), py_ue_new_fpointer_event(InMouseEvent));
7171
if (!ret)
7272
{
7373
unreal_engine_py_log_error();

Source/UnrealEnginePython/Private/Slate/UEPySPythonWidget.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SPythonWidget : public SCompoundWidget
3939
return FReply::Unhandled();
4040
}
4141

42-
PyObject *ret = PyObject_CallFunction(py_callable_on_key_char, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fcharacter_event(InCharacterEvent));
42+
PyObject *ret = PyObject_CallFunction(py_callable_on_key_char, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fcharacter_event(InCharacterEvent));
4343
if (!ret)
4444
{
4545
unreal_engine_py_log_error();
@@ -69,7 +69,7 @@ class SPythonWidget : public SCompoundWidget
6969
return FReply::Unhandled();
7070
}
7171

72-
PyObject *ret = PyObject_CallFunction(py_callable_on_key_down, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fkey_event(InKeyEvent));
72+
PyObject *ret = PyObject_CallFunction(py_callable_on_key_down, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fkey_event(InKeyEvent));
7373
if (!ret)
7474
{
7575
unreal_engine_py_log_error();
@@ -99,7 +99,7 @@ class SPythonWidget : public SCompoundWidget
9999
return FReply::Unhandled();
100100
}
101101

102-
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_move, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
102+
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_move, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
103103
if (!ret)
104104
{
105105
unreal_engine_py_log_error();
@@ -129,7 +129,7 @@ class SPythonWidget : public SCompoundWidget
129129
return FReply::Unhandled();
130130
}
131131

132-
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_wheel, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
132+
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_wheel, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
133133
if (!ret)
134134
{
135135
unreal_engine_py_log_error();
@@ -159,7 +159,7 @@ class SPythonWidget : public SCompoundWidget
159159
return FReply::Unhandled();
160160
}
161161

162-
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_down, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
162+
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_down, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
163163
if (!ret)
164164
{
165165
unreal_engine_py_log_error();
@@ -189,7 +189,7 @@ class SPythonWidget : public SCompoundWidget
189189
return FReply::Unhandled();
190190
}
191191

192-
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_up, (char *)"OO", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
192+
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_up, (char *)"NN", py_ue_new_fgeometry(MyGeometry), py_ue_new_fpointer_event(MyEvent));
193193
if (!ret)
194194
{
195195
unreal_engine_py_log_error();
@@ -230,7 +230,7 @@ class SPythonWidget : public SCompoundWidget
230230

231231
FPaintContext context(AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
232232

233-
PyObject *ret = PyObject_CallFunction(py_callable_paint, (char *)"O", py_ue_new_fpaint_context(context));
233+
PyObject *ret = PyObject_CallFunction(py_callable_paint, (char *)"N", py_ue_new_fpaint_context(context));
234234
if (!ret)
235235
{
236236
unreal_engine_py_log_error();
@@ -259,7 +259,7 @@ class SPythonWidget : public SCompoundWidget
259259
return;
260260
}
261261

262-
PyObject *ret = PyObject_CallFunction(py_callable_tick, (char *)"Off", py_ue_new_fgeometry(AllottedGeometry), InCurrentTime, InDeltaTime);
262+
PyObject *ret = PyObject_CallFunction(py_callable_tick, (char *)"Nff", py_ue_new_fgeometry(AllottedGeometry), InCurrentTime, InDeltaTime);
263263
if (!ret)
264264
{
265265
unreal_engine_py_log_error();

Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ FReply FPythonSlateDelegate::OnMouseEvent(const FGeometry &geometry, const FPoin
115115
{
116116
FScopePythonGIL gil;
117117

118-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"OO", py_ue_new_fgeometry(geometry), py_ue_new_fpointer_event(pointer_event));
118+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NN", py_ue_new_fgeometry(geometry), py_ue_new_fpointer_event(pointer_event));
119119
if (!ret)
120120
{
121121
unreal_engine_py_log_error();
@@ -135,7 +135,7 @@ FReply FPythonSlateDelegate::OnKeyDown(const FGeometry &geometry, const FKeyEven
135135
{
136136
FScopePythonGIL gil;
137137

138-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"OO", py_ue_new_fgeometry(geometry), py_ue_new_fkey_event(key_event));
138+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NN", py_ue_new_fgeometry(geometry), py_ue_new_fkey_event(key_event));
139139
if (!ret)
140140
{
141141
unreal_engine_py_log_error();
@@ -253,7 +253,7 @@ void FPythonSlateDelegate::OnLinearColorChanged(FLinearColor color)
253253
{
254254
FScopePythonGIL gil;
255255

256-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_flinearcolor(color));
256+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_flinearcolor(color));
257257
if (!ret)
258258
{
259259
unreal_engine_py_log_error();
@@ -266,7 +266,7 @@ void FPythonSlateDelegate::OnWindowClosed(const TSharedRef<SWindow> &Window)
266266
{
267267
FScopePythonGIL gil;
268268

269-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_swidget<ue_PySWindow>(StaticCastSharedRef<SWidget>(Window), &ue_PySWindowType));
269+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_swidget<ue_PySWindow>(StaticCastSharedRef<SWidget>(Window), &ue_PySWindowType));
270270
if (!ret)
271271
{
272272
unreal_engine_py_log_error();
@@ -319,7 +319,7 @@ void FPythonSlateDelegate::OnAssetDoubleClicked(const FAssetData& AssetData)
319319
{
320320
FScopePythonGIL gil;
321321

322-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_fassetdata(AssetData));
322+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData));
323323
if (!ret)
324324
{
325325
unreal_engine_py_log_error();
@@ -331,7 +331,7 @@ void FPythonSlateDelegate::OnAssetSelected(const FAssetData& AssetData)
331331
{
332332
FScopePythonGIL gil;
333333

334-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_fassetdata(AssetData));
334+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData));
335335
if (!ret)
336336
{
337337
unreal_engine_py_log_error();
@@ -343,7 +343,7 @@ void FPythonSlateDelegate::OnAssetChanged(const FAssetData& AssetData)
343343
{
344344
FScopePythonGIL gil;
345345

346-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_fassetdata(AssetData));
346+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData));
347347
if (!ret)
348348
{
349349
unreal_engine_py_log_error();
@@ -355,7 +355,7 @@ bool FPythonSlateDelegate::OnShouldFilterAsset(const FAssetData& AssetData)
355355
{
356356
FScopePythonGIL gil;
357357

358-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_fassetdata(AssetData));
358+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fassetdata(AssetData));
359359
if (!ret)
360360
{
361361
unreal_engine_py_log_error();
@@ -407,7 +407,7 @@ void FPythonSlateDelegate::MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAss
407407
PyList_Append(py_list, py_ue_new_fassetdata(asset));
408408
}
409409

410-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"OO", py_ue_new_fmenu_builder(Builder), py_list);
410+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"NO", py_ue_new_fmenu_builder(Builder), py_list);
411411
if (!ret)
412412
{
413413
unreal_engine_py_log_error();
@@ -1029,7 +1029,7 @@ class FPythonSlateCommands : public TCommands<FPythonSlateCommands>
10291029
void MenuPyBuilder(FMenuBuilder &Builder)
10301030
{
10311031
FScopePythonGIL gil;
1032-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_fmenu_builder(Builder));
1032+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_fmenu_builder(Builder));
10331033
if (!ret)
10341034
{
10351035
unreal_engine_py_log_error();
@@ -1047,7 +1047,7 @@ class FPythonSlateCommands : public TCommands<FPythonSlateCommands>
10471047
void ToolBarBuilder(FToolBarBuilder &Builder)
10481048
{
10491049
FScopePythonGIL gil;
1050-
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"O", py_ue_new_ftool_bar_builder(Builder));
1050+
PyObject *ret = PyObject_CallFunction(py_callable, (char *)"N", py_ue_new_ftool_bar_builder(Builder));
10511051
if (!ret)
10521052
{
10531053
unreal_engine_py_log_error();

0 commit comments

Comments
 (0)