I develop an AR project.
In my scene I use SCNReferenceNode to load external content.
The first time, I execute the code, everything is OK.
When I return to the homepage and reaccess to my scene, I've got a crash when I use load() for SCNReferenceNode. Crash occurs not every time. Sometimes, load() method don't crash my app. I test many things but nothing work.
Here is a part of my code when I use load() on SCNReferenceNode :
let url = Bundle.main.url(forResource: "model", withExtension: "scn", subdirectory: "map.scnassets")!
self.refNode = SCNReferenceNode(url: url)!
self.container.addChildNode(self.refNode)
self.refNode.load()
When I return on home, I try to clean my scene :
self.refNode.unload()
self.refNode = nil
But when I return in my scene (second time access), I've got a crash 'Bad Exec' :
0x1dbf6d048 <+40>: bl 0x1dbdbe374 ; C3DAnimationManagerRemoveAnimationsForObject
0x1dbdbe3ac <+56>: cbz x0, 0x1dbdbe3f8 ; <+132>
0x1a7d9562c <+100>: ldr x9, [x0]
On stack, I see 'C3DAnimationManagerRemoveAnimationsForObject' so I suppose the problem is going from an animation. I'll try to remove all actions, all loops...
I try to use Instruments(for zombies, leaks..), breakpoints but I'm to noob !!!
How can I find a solution, how can I resolve this error ?
Thanks in adavance...
Related
im using the sample code from apple for the photogrammetry session to demonstrate:
https://developer.apple.com/documentation/realitykit/creating_a_photogrammetry_command-line_app
It all works, BUT when I try to add the geometry parameter to it, it crashes/Stops in an internal break point.
The original code looks like:
if let detailSetting = detail {
return PhotogrammetrySession.Request.modelFile(url: outputUrl,
detail: detailSetting)
} else {
As soon as I add a boundary box, the code crashes/stops at an internal breakpoint.
For the demonstration I added the bounding box that got calculated by the session manually
if let detailSetting = detail {
let bx = BoundingBox(min: SIMD3<Float>(-0.5131897, -0.36881575 -0.35893312),
max: SIMD3<Float>(0.5131897, 0.36881575, 0.35893312))
let geom: PhotogrammetrySession.Request.Geometry? =
PhotogrammetrySession.Request.Geometry(
bounds: bx, transform: Transform.identity)
return PhotogrammetrySession.Request.modelFile(url: outputUrl,
detail: detailSetting,
geometry: geom)
} else {
I know I had the bounding box working before, but I don't see why it stopped.
Does anyone know if that is a known problem in a softwareupdate or something else out of my control?
The debugger shows:
The output is unsuspicious:
And the backtrace is
not useful to me.
Any suggestions?
Thank you
It seems to be fixed with Monteray 12.3
Adding a SCNReferenceNode works when done from the Xcode Scene Editor. When done programmatically with the code below, however, nothing appears in the scene.
filePath contains a valid path as proven by the print statement as well as stepping through the code.
Help?
if let filePath = NSBundle.mainBundle().pathForResource("RefTest", ofType: "scn", inDirectory: "TestScene.scnassets") {
let referenceURL = NSURL(fileURLWithPath: filePath)
if #available(iOS 9.0, *) {
let referenceNode = SCNReferenceNode(URL: referenceURL)
scene!.rootNode.addChildNode(referenceNode!)
print(referenceNode)
}
}
The class docs claim that the loading policy instructs the SCNReferenceNode to load immediately by default:
When the reference node loads its content (either automatically,
according to the loadingPolicy property, or when you call the load
method), SceneKit loads the referenced scene file. All children of the
scene file’s root node become children of the reference node.
However, this doesn't seem to happen by default. You must invoke the load function like so:
let referenceNode = SCNReferenceNode(URL: referenceURL
referenceNode.load()
Alternatively, perhaps you could play with the loadingPolicy property as well, but invoking the load function definitely works.
I create an GtkFixed object and put it into GtkEventBox via gtk_container_add (with destroying previous child, of course). This way works fine on Windows, but on Mac it crashes.
Stack trace showed me that app crashed on gtk_get_parent. I've tried to user set_parent procedure, but it crashes too:
[debug][New Thread 0x1b0f of process 88699]
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug]0x0000000100b3cf3d in gtk_widget_set_parent () from /usr/local/lib/libgtk-3.0.dylib
[debug]>>>>>>cb_gdb:
Program received signal SIGSEGV, Segmentation fault.
In gtk_widget_set_parent () (/usr/local/lib/libgtk-3.0.dylib)
[debug]> bt 30
[debug]#0 0x0000000100b3cf3d in gtk_widget_set_parent () from /usr/local/lib/libgtk-3.0.dylib
Code runned in main thread and in "realize" callback of Window. Same.
The code is:
void main_view_reset_list_view(GtkWidget* list_view, GtkWidget* new_item)
{
GtkEventBox* eb = GTK_EVENT_BOX(list_view);
GtkBin* bin = GTK_BIN(list_view);
GtkContainer* container = GTK_CONTAINER(list_view);
GtkWidget* subview;
subview = gtk_bin_get_child(bin);
if (subview)
{
gtk_container_remove(container, subview);
gtk_widget_unparent (subview);
gtk_widget_destroy(subview);
}
gtk_widget_set_parent(new_item, container); // crash
GtkWidget* parent = gtk_widget_get_parent(container);
GtkWidget* parent2 = gtk_widget_get_parent(new_item); // 0 on windows, crash on mac
if (new_item)
{
gtk_container_add(container, new_item);
gtk_widget_show(new_item);
}
gtk_widget_show(list_view);
}
UPD:
set_parent makes controls dissapeared somehow on windows
I've traced gtk and glib source code and figured that G_IS_OBJECT() fails, which is quite weird. This post have brought me to mind that this issue is pointer-related. I've debugged my code and saw that it is true.
GtkWidget* create_widget()
{
return gtk_fixed_new(); // result points to 0x1018bf830
}
void refresh_widgets()
{
GtkWidget* w = create_widget(); // w points to 0x18bf830
}
I've actually faced with this kind of issue before, so all code which return pointers has been changed:
char* generate_string();
to
void generate_string(char** out);
So in order to fix my problem I have to provide correct pointers in this way. Like:
void create_widget(GtkWidget** out);
UPD: I've noticed difference between pointers. Shortly say, somehow they are trimmed to 32 bit on 64 bit system on return.
UPD2: Finally, I've made all changes and it works that way.
This is my first post. I apologize for mistakes.
I have a crash I can fix, but I don't understand why it crashes in the first place. I tried to reduce the code to the essentials to make it crash:
GCFTile *currentTile;
NSInteger repeatCount = 0;
do {
currentTile = self.remainingTilesArray[0];
if (repeatCount == 0) {
[self.remainingTilesArray removeObjectAtIndex:0];
[self.remainingTilesArray addObject:currentTile];
}
void (^myBlock)() = ^{
currentTile;
};
repeatCount++;
} while (repeatCount == 1);
I'm using Xcode 4.5.2, iOS 5, ARC. Also, it crashes only if the LLVM compiler optimization is set to "Fast" or above.
The code above will get and remove an object from an NSMutableArray, put it back, and then get another object from the array. The code above will run without crashing, but if I scan across all the elements in the array later (e.g., from a different method), then it crashes. It looks like a random memory address was added to the array (probably from the above call to addObject).
The above block should do nothing, but if I change it then there's no crash later. (E.g., empty block = no crash. Don't declare block as "myBlock" = no crash.) If I don't repeat the loop, there's no crash. If I don't add the object back, there's no crash. If I declare currentTile using __block or within the do loop, there's no crash.
I know blocks are "stack-local," but this block doesn't do anything! And it runs fine without compiler optimization.
Any idea what's going on?
EDIT (12-5-12): Someone asked for the crash log. I'm running in the simulator, so I don't know how to get that. But here's a little from the Debug Navigator:
#0 0x0140409b in objc_msgSend ()
#1 0x00010931 in __33-[GCFGame checkThatTilesAreValid]_block_invoke_0 at /Users/geoffrey2/personal/projects/Color Fever/Color Fever/GCFGame.m:54
#2 0x01cb24a5 in __NSArrayEnumerate ()
#3 0x01cb2026 in -[NSArray enumerateObjectsWithOptions:usingBlock:] ()
#4 0x01cb1f35 in -[NSArray enumerateObjectsUsingBlock:] ()
#5 0x000108f6 in -[GCFGame checkThatTilesAreValid] at /Users/geoffrey2/personal/projects/Color Fever/Color Fever/GCFGame.m:52
and the main window shows this (plus more lines):
libobjc.A.dylib`objc_msgSend:
0x140408c: movl 8(%esp), %ecx
0x1404090: movl 4(%esp), %eax
0x1404094: testl %eax, %eax
0x1404096: je 0x14040e8 ; objc_msgSend + 92
0x1404098: movl (%eax), %edx
0x140409a: pushl %edi
0x140409b: movl 8(%edx), %edi
The error is EXC_BAD_ACCESS(code=2, adddress=0x9).
The FDMSLib for the Flex-AJAX bridge has a load function that renders a flash object to the page where ever it is called. This causes problems when using Ext.JS as the inserted object can either be discarded by another render function or cause conflicts during the rendering of the page, so I'm trying to rewrite the load function so that its Ext.JS (and probably other JS framework) friendly.
This is the original function.
FDMSLibrary.load = function(path, callback)
{
var result = "<object id='_fesLib' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' \
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,5,0,0' \
height='1' width='1'> \
<param name='flashvars' value='bridgeName=flash'/> \
<param name='AllowScriptAccess' value='always'/> \
<param name='src' value='"+ (path != undefined ? path : "") + "'/> \
<param name='wmode' value='transparent' /> \
<embed name='_fesLib' pluginspage='http://www.macromedia.com/go/getflashplayer' allowScriptAccess='always'\
src='" + (path != undefined ? path : "") + "' height='1' width='1' flashvars='bridgeName=flash'/> \
</object>";
document.write(result);
// todo:need a callback and variable here so you can keep track that both the fabridge and the fdmsbridge are available
FDMSLibrary.addInitializationCallback("flash", callback);
// register for call back when the FABridge has completed initialization
FABridge.addInitializationCallback("flash", FABridge_ready);
}
I've replaced this with the following :
loadFDMSBridge: function(path,callback) {
var FABridgeSWF = new Ext.FlashComponent({
id : '_fesLib',
height: '1',
width: '1',
flashVars : {
bridgeName:'flash'
},
wmode : 'transparent',
flashVersion : '8.5.0.0',
renderTo : Ext.getBody(),
url : path,
listeners : {
'render' : {
fn : this.initBridge,
scope : this
}
}
});
},
initBridge : function () {
FDMSLibrary.addInitializationCallback("flash", this.initPolling);
FABridge.addInitializationCallback("flash", FABridge_ready);
}
The flash object is rendered to the page, it uses the data attribute in object rather than a src param, but I assume this is correct for rendering flash objects.
The problem I'm having with this is that when I call the FDMSLibrary.addInitializationCallback function it would appear that the bridge is not ready.
The javascript is told by the swf file that it is ready to be used. I'm pretty certain that its no a problem with the swf as I have an simple test page up and running using the same swf and javascript libraries, but without any interference from any other javascript, content and so on. It kind of feels like the swf isn't being loaded and "executed" and Firebug would seem to back this up, but I don't really know why or what I've missed.
If you would like to see the full javascript libraries and the actionscript source for the FABridge you can find them here in Adobe's subversion repo : fds ajax bridge repo path
Thanks in advance for your help
Not sure, but you might try the afterrender event instead of render. As it happens later in the rendering cycle (well, after it :) it might help -- I know that there have been issues in the past with render firing before certain pieces of a component were actually done rendering (which is why the afterrender event was later added).
Another thing if that doesn't work might be to try deferring your initBridge functionality slightly. This is a bit of a stretch, but I've seen the case before where there is either a timing issue with the JS execution, or possibly some blocking that causes this type of symptom. Deferring your code will both delay its execution and execute it on a new thread, which may solve the problem. Not the best solution, but I've worked around several browser quirks this way. E.g.:
initBridge : function () {
(function(){
FDMSLibrary.addInitializationCallback("flash", this.initPolling);
FABridge.addInitializationCallback("flash", FABridge_ready);
}).defer(500, this);
}
At least this might confirm whether or not it's a timing/blocking issue. You can adjust the 500 (ms) up or down to see if you hit any difference in behavior.
#bmoeskau : thanks for the helpful suggestions.
Looking at my code again with your suggestions I realised a couple of things.
First was that I was making changes in the wrong files. I'd made a standalone version and had accidentally been editing those files and not the ext.js application.
Secondly, with all the changes,testing and general messing about I had managed to overload some of my functions, which meant that the wrong functions were being called. No matter how much I changed the function I was looking at it never got called.
The above code actually works as stated.
Just to tidy this up :
I had continuing issues courtesy of a Firefox bug and swfobjects (the underlying library for Ext.Flashcomponent). I ended up having to push the original html from the FDMSLib load() function into the DOM rather than use the Ext object.
// spec up the flash object for FABridge
var foSpec = {
tag : 'object',
id : '_fesLib',
classid : 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
codebase: 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,5,0,0',
height :'1',
width : '1',
cn : [
{tag:'param', name:'flashvars', value:'bridgeName=flash'},
{tag:'param', name:'AllowScriptAccess', value:'always'},
{tag:'param', name:'src', value:path},
{tag:'param', name:'wmode', value:'transparent'},
{tag:'embed', name:"_fesLib", pluginspage:'http://www.macromedia.com/go/getflashplayer', allowScriptAccess:'always', src:path, height:'1', width:'1', flashvars:'bridgeName=flash'}
]
};
// Add it to the end of the body
Ext.getBody().createChild(foSpec);
I vaguely recall a post somewhere that says that FABridge uses the "embed" tag and as swfobject doesn't insert an "embed" tag this may also have been causing issues.
To add to this, the flashParams property of Ext.Flashcomponent makes reference to this adobe technote on required params. This states that an object only inclusion of a flash object must include the param "movie". swfobject forcibly removes any param with the name "movie".
Not much fun to be had anywhere with this!