2017-06-27
11:25 AM
- last edited on
2022-12-06
02:03 PM
by
Daniel Kassai
Jun 27 11:56:25 Julians-iMac Archicad 20.app[20357]: ====>GeneralSignalHandler received signal=11 Jun 27 11:56:25 Julians-iMac Archicad 20.app[20357]: ====>GeneralSignalHandler calling OOP handler Jun 27 11:56:26 Julians-iMac Archicad 20.app[20357]: Archicad [20357] crashed with signal 11. Report written to: /Users/ivan/Library/Application Support/Graphisoft/BugReporting-20/Archicad-20170627(08-49-05)-[20357]-FATAL.rpt Jun 27 11:56:27 Julians-iMac Archicad 20.app[20357]: ====>GeneralSignalHandler restoring previous handlers Jun 27 11:56:27 Julians-iMac com.apple.xpc.launchd[1] (com.Graphisoft.Archicad.17352[20357]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
void openWindowAndWebView(void)
{
NSWindow *window =
[[NSWindow alloc]
initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask: NSWindowStyleMaskClosable backing: NSBackingStoreBuffered defer: YES];
[window center];
window.title = @"Hello World";
[window makeKeyAndOrderFront:window];
[window setStyleMask:[window styleMask] | NSWindowStyleMaskTitled | NSWindowStyleMaskResizable];
//
// Window_delegate *d = [Window_delegate new];
// window.delegate = d;
//
WebView *wb = [[WebView alloc] initWithFrame:window.contentView.frame];
wb.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
[window.contentView addSubview:wb];
[[wb mainFrame]
loadRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:@"http://www.cars.bg"]]];
}
#endif
void openWebView(void){
WriteReport("Open web view");
#ifdef __OBJC__
WriteReport("it is OBJC!");
@autoreleasepool {
openWindowAndWebView();
}
#endif
}
I will be very helpful if you can help me, or just guide me how to debug it.2017-06-27 05:20 PM
jcimentarov wrote:Some more information about the context you're opening the webview into would be useful, e.g. are running this in a separate process to ARCHICAD?
I'm trying to open an cocoa webview into my archicad add-on and after it opens its possible to browse a web page for a little, and after e few random clicks on links the whole archicad crashes just like it hits some memory limit or something.
2017-06-28 09:00 AM
GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *menuParams)
{
if (menuParams->menuItemRef.menuResID == 32500) {
GSErrCode errorCode = ACAPI_CallUndoableCommand ("Importer",
[&] () -> GSErrCode {
switch (menuParams->menuItemRef.itemIndex) {
case 1: openFileDialog(); break;
case 2: openWebView();break;
default: return NoError;
}
});
return errorCode;
}
return NoError;
}
This is where I'm calling my method which is opening the window with the webview. I'm still a newbie to c++ and I'm not pretty sure if it runs in a different thread than the add-on. How can I check that, and if it doesn't run in a separate threat how could I fix it?
2017-06-30 12:49 PM
jcimentarov wrote:The menu command handler runs on the main thread.GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *menuParams) { if (menuParams->menuItemRef.menuResID == 32500) { GSErrCode errorCode = ACAPI_CallUndoableCommand ("Importer", [&] () -> GSErrCode { switch (menuParams->menuItemRef.itemIndex) { case 1: openFileDialog(); break; case 2: openWebView();break; default: return NoError; } }); return errorCode; } return NoError; }This is where I'm calling my method which is opening the window with the webview. I'm still a newbie to c++ and I'm not pretty sure if it runs in a different thread than the add-on. How can I check that, and if it doesn't run in a separate threat how could I fix it?