Skip to content

Commit

Permalink
Fixed a crash when creating an object while handling a Qt meta-call.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <[email protected]>
  • Loading branch information
ddobrev committed Sep 19, 2017
1 parent d509ac6 commit e231735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.7.3 - 19.9.2017
Fixed:
- Crash when creating an object while handling a Qt meta-call.

0.7.2 - 18.9.2017
Added:
- Bindings for the constructors of QImage and QPixmap taking arrays;
Expand Down
7 changes: 6 additions & 1 deletion QtSharp/QObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ private object GetParameterValue(Handler handler, int i, System.Reflection.Param
case TypeCode.Empty:
return null;
case TypeCode.Object:
return Activator.CreateInstance(type, arg);
var constructor = type.GetMethod("__CreateInstance",
global::System.Reflection.BindingFlags.NonPublic |
global::System.Reflection.BindingFlags.Static |
global::System.Reflection.BindingFlags.FlattenHierarchy,
null, new[] { typeof(IntPtr), typeof(bool) }, null);
return constructor.Invoke(null, new object[] { arg, false });
case TypeCode.DBNull:
return DBNull.Value;
case TypeCode.Boolean:
Expand Down

0 comments on commit e231735

Please sign in to comment.