Comments (9)
Looks like this line of code causes the crash: https://github.com/xamarin/urho/blob/master/Samples/Samples/InProgress/02_HelloGUI.cs#L174 if (comment only L174 - the crash won't reproduce)
Thus the problem is in the:
[DllImport ("mono-urho")]
internal static extern string UIElement_GetName (IntPtr handle);
from urho.
Probably, all bridge.cpp methods returning const char * have same behavior.
from urho.
Can be fixed by duplicating string:
DllExport const char *
UIElement_GetName (Urho3D::UIElement *_target)
{
return _target->GetName ().CString ();
}
to
DllExport const char *
UIElement_GetName (Urho3D::UIElement *_target)
{
return strdup (_target->GetName ().CString ());
}
from urho.
better solution without strdup:
[DllImport ("mono-urho", CallingConvention = CallingConvention.Cdecl)]
internal static extern string UIElement_GetName (IntPtr handle);
private string GetName ()
{
return UIElement_GetName (handle);
}
to
[DllImport ("mono-urho", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr UIElement_GetName (IntPtr handle);
private string GetName ()
{
return Marshal.PtrToStringAnsi(UIElement_GetName (handle));
}
from urho.
umm... this also works (setting CharSet):
[DllImport ("mono-urho", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern string UIElement_GetName (IntPtr handle);
from urho.
Fixed with strdup.
from urho.
Late to the party, but wouldn't a custom marshaller work better than strduping?
https://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp/Core/Utf8Marshaler.cs#L18
from urho.
The reasoning is not leaking anything in case something in Urho itself calls methods which would do the strdup, but never clean it up.
from urho.
I think that would work, I will keep it in mind. I need to measure if the generated code would be larger than what we have (in particular on iOS)
from urho.
Related Issues (20)
- Dependency injection for Application HOT 2
- Red/Blue color reversal with .png files on iOS
- Textures get deleted unintendedly
- Showing UrhoSurface shows status bar on iOS
- Question about left hand coordinates HOT 2
- Visual Studio 2019 Community and Xamarin + Urho -- Could not find resource
- urho Binding xamarin forms WPF
- Urho3D view is wrong size with iOS 14 HOT 2
- Provide Nuget Packages for .NET Core 3.1 of UrhoSharp.WinForms HOT 6
- UrhoSharp on UWP Xamarin Forms - Disposes when you Navigate to new Page
- Linux support
- Cannot Build UrhoSharp - Build Instructions seem broken
- License is ambiguous
- How to setup the UrhoSharp engine to render on a live wallpaper on Xamarin Android platform ?
- How to update with the latest 3D Engine version?
- Urho.Forms.UrhoSurface.OnDestroy(); Crash
- Inverse Kinematic functionality missing
- Placing an item on the wall with UrhoSharp
- MAUI Support
- UnhandledException Not Firing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urho.