{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1397","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1397/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1397/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1397/events","html_url":"https://github.com/realm/realm-java/issues/1397","id":101633172,"number":1397,"title":"I get Fatal signal 11 error when i call  recursive delete from my fragment.","user":{"login":"aercanozcan","id":2137007,"avatar_url":"https://avatars.githubusercontent.com/u/2137007?v=3","gravatar_id":"","url":"https://api.github.com/users/aercanozcan","html_url":"https://github.com/aercanozcan","followers_url":"https://api.github.com/users/aercanozcan/followers","following_url":"https://api.github.com/users/aercanozcan/following{/other_user}","gists_url":"https://api.github.com/users/aercanozcan/gists{/gist_id}","starred_url":"https://api.github.com/users/aercanozcan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aercanozcan/subscriptions","organizations_url":"https://api.github.com/users/aercanozcan/orgs","repos_url":"https://api.github.com/users/aercanozcan/repos","events_url":"https://api.github.com/users/aercanozcan/events{/privacy}","received_events_url":"https://api.github.com/users/aercanozcan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/support","name":"support","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-18T11:20:31Z","updated_at":"2015-08-26T09:21:24Z","closed_at":null,"body":"```\r\ndeleteForm(formObject,getActivity);\r\n```\r\n\r\nFatal signal 11 (SIGSEGV) at 0x00000094 (code=1), thread 6200 (om.infoline.ats)\r\n\r\nthe strange thing is : it does not  cause that error when i call this from an onClick inside of a listview item with\r\nRealmBaseAdapter.getItem(position).\r\n\r\nMethod TLDR: it  deletes the FormObjects with cascade using for loop and recursion. It marks all forms as deleted then deletes all marked forms.\r\n\r\n```\r\npublic static void deleteForm(FormObject formObject,Context context){\r\n        Realm realm = Realm.getInstance(context);\r\n        realm.beginTransaction();\r\n        recursiveFormDelete(realm, formObject);\r\n        setDeletedSingleForm(realm, formObject);\r\n        realm.where(FormObject.class).equalTo(\"deleted\",true).findAll().clear();\r\n        realm.commitTransaction();\r\n        realm.close();\r\n    }\r\n\r\n    /**\r\n     * deletes all children forms as a tree.\r\n     * @param realm\r\n     * @param formObject\r\n     */\r\n    public static void recursiveFormDelete(Realm realm,FormObject formObject){\r\n        RealmResults<FormObject> results=realm.where(FormObject.class).equalTo(\"firstVisitFormId\",formObject.getFormId()).findAll();\r\n        int size= results.size();\r\n\r\n        for(int i =0 ; i< size;i++){\r\n            FormObject item = results.get(i);\r\n            if(realm.where(FormObject.class).equalTo(\"firstVisitFormId\",formObject.getFormId()).count()>0){\r\n                recursiveFormDelete(realm,item);\r\n            }\r\n            setDeletedSingleForm(realm,item);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Removes options questions and formpages of this form. and marks the form as deleted.\r\n     * @param realm\r\n     * @param formObject\r\n     */\r\n    public static void setDeletedSingleForm(Realm realm, FormObject formObject){\r\n        String id=formObject.getFormId();\r\n        realm.where(Question.class).equalTo(\"formId\",id).findAll().clear();\r\n        realm.where(Option.class).equalTo(\"formId\",id).findAll().clear();\r\n        realm.where(Answer.class).equalTo(\"formId\",id).findAll().clear();\r\n        realm.where(Answer.class).equalTo(\"parentFormId\",id).findAll().clear();\r\n        formObject.getFormPages().clear();\r\n        formObject.setDeleted(true);\r\n    }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/134913613","html_url":"https://github.com/realm/realm-java/issues/1397#issuecomment-134913613","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1397","id":134913613,"user":{"login":"kneth","id":1225363,"avatar_url":"https://avatars.githubusercontent.com/u/1225363?v=3","gravatar_id":"","url":"https://api.github.com/users/kneth","html_url":"https://github.com/kneth","followers_url":"https://api.github.com/users/kneth/followers","following_url":"https://api.github.com/users/kneth/following{/other_user}","gists_url":"https://api.github.com/users/kneth/gists{/gist_id}","starred_url":"https://api.github.com/users/kneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kneth/subscriptions","organizations_url":"https://api.github.com/users/kneth/orgs","repos_url":"https://api.github.com/users/kneth/repos","events_url":"https://api.github.com/users/kneth/events{/privacy}","received_events_url":"https://api.github.com/users/kneth/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T09:21:24Z","updated_at":"2015-08-26T09:21:24Z","body":"Can you share your code (if only privately, send an email to help@realm.io)? We try to give a proper error message if you try to access Realm object on another thread, and we would like to see if you have found a corner case where our logical isn't sufficient."}}