Bus Errors: Corona Bug or Error in Code

I am currently getting this error and corona crashes:
/Users/myMac/Desktop/CoronaSDK/Corona Terminal: line 9: 27835 Bus error: 10           "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $*

Is this a bug with Corona or is there an error in my code?

Here's a great post relating to bus error, why it happens and how you might be able to go about fixing it:

http://developer.anscamobile.com/forum/2011/05/26/bus-error

Good luck!

Not a Corona bug, but likely an error in your code - are you using physics?

Does it happen under certain situations? Like on removal of physical bodies ?

The first time it happened was after leaving a scene that had physics with director, so it would have made sense. I would have assumed it had something to do with the physics. But after that it started occurring when on scene that does not have physics(and no physics up to that point). The scene that it crashes on only has transitions and timers. It doesn't happen every time but it is very worrisome.

Are you canceling your active transitons/timers before changing scenes?

Yeah, I actually created a director wrapper that candles all transitions and timers. I can post the code and the mac crash report. Just let me know what is the best way to post it.

Thanks

Okay this is getting really frustrating. I am putting the app on my phone, and it crashes or restarts the app on that same screen.

This is ridiculous. Why doesn't this code work???? It crashes during playFirst on my phone and crashes Corona randomly on all scenes. The other ones rarely work when they want to. What is going on? And I am not getting any errors from Corona or Director.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
module( ...,package.seeall )
-----------------------------
-- LOCAL VARIABLES
-----------------------------
local deviceWidth = display.contentWidth 
local deviceHeight = display.contentHeight
local centered = {x = deviceWidth * 0.5, y = deviceHeight * 0.5}
local localTransitions = {}
local localTimers = {}
local myParams = {}
 
-----------------------------
-- MAIN GROUP
-----------------------------
 
local sceneGroup = display.newGroup()
 
function delaySkip()
        function sceneGroup:tap( event )
                scenes:changeScene("stageScreen", "fade", params, localTransitions, localTimers)
        end 
        sceneGroup:addEventListener("tap", sceneGroup)
end
localTimers["delaySkip1"] = timer.performWithDelay(1000, delaySkip)
 
-----------------------------
-- ANIMATE FUNCTIONS
-----------------------------
-----------------------------
-- SCENES
-----------------------------
        -----------------------------
        -- SCENE ONE
        -----------------------------
local function playFirst()
        sceneGroup:removeEventListener("tap", sceneGroup)
        function delaySkip()
                function sceneGroup:tap( event )
                        scenes:changeScene("playScreen", "fade", params, localTransitions, localTimers)
                end 
                sceneGroup:addEventListener("tap", sceneGroup)
        end
        localTimers["delaySkip1"] = timer.performWithDelay(1000, delaySkip)
        
        local scene = display.newGroup()
        sceneGroup:insert(scene)
        
        local bg1 = display.newImage("scene1_1a.png", true)
        sceneGroup:insert(bg1)  
        bg1.x, bg1.y = centered.x, centered.y
        
        local bg2, bg3, bg4, bg5 = nil
        local function transition1()
                bg2 = display.newImage("scene1_1b.png", true)
                sceneGroup:insert(bg2)
                bg2.x, bg2.y = centered.x, centered.y
                
        end
 
        local function transition2()
                bg3 = display.newImage("scene1_2.png", true)
                sceneGroup:insert(bg3)
                bg3.x, bg3.y = centered.x, centered.y
                
        end
 
        local function transition3()
                bg4 = display.newImageRect("scene5_4.jpg", 480, 320)
                scene:insert(bg4)
                bg4.x, bg4.y = centered.x, centered.y
                bg4.alpha = 0
                
                localTransitions["scene5_4a"] = transition.to(bg3, {time = 500, alpha = 0})
                localTransitions["scene5_4b"] = transition.to(bg4, {time = 500, alpha = 1, onComplete = function() bg3:removeSelf() end})
        end
 
        local function transition4()
                localTransitions["scene5_5"] = transition.to(bg4, {time = 500, alpha = 0, onComplete = function() bg4:removeSelf() end})
        end
        
        local function transition5()
                bg5 = display.newGroup()
                scene:insert(bg5)
                bg5.alpha = 0
                
                local s1 = display.newImageRect("scene5_5_01.png", 480, 349)
                bg5:insert(s1)
                s1.x, s1.y = centered.x, centered.y
                
                local s2 = display.newImageRect("scene5_5_02.png", 480, 439)
                bg5:insert(s2)
                s2.x, s2.y = centered.x, s1.y + s2.height * 0.895
                
                local s3 = display.newImageRect("scene5_5_03.png", 480, 393)
                bg5:insert(s3)
                s3.x, s3.y = centered.x, s2.y + 416
                
                localTransitions["scene5_6"] = transition.to(bg5, {time = 500, alpha = 1})
        end
        
        local function transition6()
                localTransitions["scene5_5"] = transition.to(bg5, {time = 5000, y = -bg5.height * 0.7125})
        end
        
        local function transition7()
                bg6 = display.newImageRect("thend.png", 320, 480)
                scene:insert(bg6)
                bg6.x, bg6.y = centered.x, centered.y 
                bg6.alpha = 0 
                
                localTransitions["scene5_fine"] = transition.to(bg6, {time = 500, alpha = 1})
        end
 
                -----------------------------
                -- SCENE FOUR PLAY
                -----------------------------   
        localTimers["scene5_1"] = timer.performWithDelay(2000, transition1)
        localTimers["scene5_2"] = timer.performWithDelay(3500, transition2)
        --localTimers["scene5_3"] = timer.performWithDelay(5000, transition3)
        --localTimers["scene5_4"] = timer.performWithDelay(6500, transition4)
        --localTimers["scene5_5"] = timer.performWithDelay(9000, transition5)
        --localTimers["scene5_6"] = timer.performWithDelay(11000, transition6)
        --localTimers["scene5_7"] = timer.performWithDelay(12000, transition7)
        
end
 
        -----------------------------
        -- SCENE TWO
        -----------------------------
local function playSecond()
        print("PLaying Second Clip")
        local scene = display.newGroup()
        sceneGroup:insert(scene)
        
        local bg1 = display.newImageRect("scene2_1.jpg", 480, 320)
        scene:insert(bg1)
        bg1.x, bg1.y = centered.x, centered.y
        bg1.alpha = 1
        
        local bg2, bg3 = nil
        local function transition1()
                localTransitions["scene2_1"] = transition.to(bg1, {time = 500, alpha = 0})
        end
        
        --raining
        local function transition2()
                bg2 = display.newGroup()
                scene:insert(bg2)
                bg2.alpha = 0
                
                local bg2a = display.newImageRect("scene2_2.jpg", 480, 320)
                bg2:insert(bg2a)
                bg2a.x, bg2a.y = centered.x, centered.y
                
                local function rain()
                        local rain1 = display.newImageRect("scene2_2screen.png", 480, 320)
                        bg2:insert(rain1)
                        rain1.x, rain1.y = centered.x, centered.y
                        rain1.alpha = .3
 
                end
                rain()
                localTransitions["scene2_2"] = transition.to(bg2, {time = 500, alpha = 1, onComplete = function() bg1:removeSelf() end})
        end
        
        local function transition3()
                localTransitions["scene2_2"] = transition.to(bg2, {time = 500, alpha = 0, onComplete = function() bg2:removeSelf() end})
        end
        
        local function transition4()
                bg3 = display.newImageRect("scene2_3.jpg", 480, 320)
                scene:insert(bg3)
                bg3.x, bg3.y = centered.x, centered.y
                bg3.alpha = 0
                
                localTransitions["scene2_3"] = transition.to(bg3, {time = 500, alpha = 1})
        end
        
        local function transition5()
                localTransitions["scene2_fine"] = transition.to(bg3, {time = 500, alpha =0, onComplete = function() bg3:removeSelf(); scenes:changeScene("stageScreen", "fade", params, localTransitions, localTimers) end })
        end
        
                -----------------------------
                -- SCENE TWO PLAY
                -----------------------------   
        localTimers["scene2_1"] = timer.performWithDelay(2000, transition1)
        localTimers["scene2_2"] = timer.performWithDelay(3000, transition2)
        localTimers["scene2_3"] = timer.performWithDelay(8000, transition3)
        localTimers["scene2_4"] = timer.performWithDelay(8000, transition4)
        localTimers["scene2_fine"] = timer.performWithDelay(12000, transition5)
end
 
        -----------------------------
        -- SCENE THREE
        -----------------------------
local function playThird()
        local scene = display.newGroup()
        sceneGroup:insert(scene)
        
        local bg1 = display.newImageRect("scene3_1.jpg", 806, 320)
        scene:insert(bg1)  
        bg1.x, bg1.y = centered.x + bg1.width * 0.2, centered.y
        
        local bg2, bg3, bg4 = nil
        local function transition1()
                localTransitions["scene3_1"] = transition.to(bg1, {time = 1000, x = centered.x - bg1.width * 0.2})
        end
        
        
        local function transition2()
                bg2 = display.newImageRect("scene3_2.jpg", 806, 320)
                bg2.x, bg2.y = bg1.x, bg1.y
        end
        
        local function transition3()
                localTransitions["scene3_1b"] = transition.to(bg2, {time = 1000, x = centered.x + bg2.width * 0.2, onComplete = function() bg1:removeSelf() end})
        end
        
        local function transition4()
                localTransitions["scene3_fine"] = transition.to(bg2, {time = 500, alpha =0, onComplete = function() bg2:removeSelf(); scenes:changeScene("stageScreen", "fade", params, localTransitions, localTimers) end })
        end
                -----------------------------
                -- SCENE THREE PLAY
                -----------------------------   
        localTimers["scene3_1"] = timer.performWithDelay(2000, transition1)
        localTimers["scene3_1a"] = timer.performWithDelay(4500, transition2)
        localTimers["scene3_1b"] = timer.performWithDelay(6000, transition3)
        localTimers["scene3_fine"] = timer.performWithDelay(9000, transition4)
 
end
        
        -----------------------------
        -- SCENE FOUR
        -----------------------------
local function playFourth()
        local scene = display.newGroup()
        sceneGroup:insert(scene)
        
        local bg1 = display.newImage("scene4_1.jpg", true)
        scene:insert(bg1)  
        bg1.x, bg1.y = 545, centered.y
        
        local function transition1()
                localTransitions["scene4_1"] = transition.to(bg1, {time = 2500, x = -55})
        end
        --[[
        local function transition2()
                localTransitions["scene4_1b"] = transition.to(bg1, {time = 1000, x = 100, xScale =.7, yScale = .7})
        end     
        ]]--
        
        local function transition4()
                localTransitions["scene4_fine"] = transition.to(bg1, {time = 500, alpha =0, onComplete = function() bg1:removeSelf(); scenes:changeScene("stageScreen", "fade", params, localTransitions, localTimers) end })
        end
                -----------------------------
                -- SCENE FOUR PLAY
                -----------------------------   
        localTimers["scene4_1a"] = timer.performWithDelay(2000, transition1)
        localTimers["scene4_fine"] = timer.performWithDelay(7000, transition4)
        --[[
        localTimers["scene4_1b"] = timer.performWithDelay(7000, transition2)
        localTimers["scene4_1c"] = timer.performWithDelay(6000, transition3)
        ]]--
end
        
        -----------------------------
        -- SCENE FIFTH
        -----------------------------
local function playFifth()
        sceneGroup:removeEventListener("tap", sceneGroup)
        function delaySkip()
                function sceneGroup:tap( event )
                        scenes:changeScene("playScreen", "fade", params, localTransitions, localTimers)
                end 
                sceneGroup:addEventListener("tap", sceneGroup)
        end
        localTimers["delaySkip1"] = timer.performWithDelay(1000, delaySkip)
        
        local scene = display.newGroup()
        sceneGroup:insert(scene)
        
        local bg1 = display.newImage("scene5_1.jpg", true)
        scene:insert(bg1)  
        bg1.x, bg1.y = centered.x, centered.y
        
        local bg2, bg3, bg4, bg5 = nil
        local function transition1()
                bg2 = display.newImageRect("scene5_2.jpg", 480, 320)
                scene:insert(bg2)
                bg2.x, bg2.y = centered.x, centered.y
                bg2.alpha = 0
                
                localTransitions["scene5_2a"] = transition.to(bg1, {time = 500, alpha = 0})
                localTransitions["scene5_2b"] = transition.to(bg2, {time = 500, alpha = 1, onComplete = function() bg1:removeSelf() end})
        end
 
        local function transition2()
                bg3 = display.newImageRect("scene5_3.jpg", 480, 320)
                scene:insert(bg3)
                bg3.x, bg3.y = centered.x, centered.y
                bg3.alpha = 0
                
                localTransitions["scene5_3a"] = transition.to(bg2, {time = 500, alpha = 0})
                localTransitions["scene5_3b"] = transition.to(bg3, {time = 500, alpha = 1, onComplete = function() bg2:removeSelf() end})
        end
 
        local function transition3()
                bg4 = display.newImageRect("scene5_4.jpg", 480, 320)
                scene:insert(bg4)
                bg4.x, bg4.y = centered.x, centered.y
                bg4.alpha = 0
                
                localTransitions["scene5_4a"] = transition.to(bg3, {time = 500, alpha = 0})
                localTransitions["scene5_4b"] = transition.to(bg4, {time = 500, alpha = 1, onComplete = function() bg3:removeSelf() end})
        end
 
        local function transition4()
                localTransitions["scene5_5"] = transition.to(bg4, {time = 500, alpha = 0, onComplete = function() bg4:removeSelf() end})
        end
        
        local function transition5()
                bg5 = display.newGroup()
                scene:insert(bg5)
                bg5.alpha = 0
                
                local s1 = display.newImageRect("scene5_5_01.png", 480, 349)
                bg5:insert(s1)
                s1.x, s1.y = centered.x, centered.y
                
                local s2 = display.newImageRect("scene5_5_02.png", 480, 439)
                bg5:insert(s2)
                s2.x, s2.y = centered.x, s1.y + s2.height * 0.895
                
                local s3 = display.newImageRect("scene5_5_03.png", 480, 393)
                bg5:insert(s3)
                s3.x, s3.y = centered.x, s2.y + 416
                
                localTransitions["scene5_6"] = transition.to(bg5, {time = 500, alpha = 1})
        end
        
        local function transition6()
                localTransitions["scene5_5"] = transition.to(bg5, {time = 5000, y = -bg5.height * 0.7125})
        end
        
        local function transition7()
                bg6 = display.newImageRect("thend.png", 320, 480)
                scene:insert(bg6)
                bg6.x, bg6.y = centered.x, centered.y 
                bg6.alpha = 0 
                
                localTransitions["scene5_fine"] = transition.to(bg6, {time = 500, alpha = 1})
        end
 
                -----------------------------
                -- SCENE FOUR PLAY
                -----------------------------   
        localTimers["scene5_1"] = timer.performWithDelay(2000, transition1)
        localTimers["scene5_2"] = timer.performWithDelay(3500, transition2)
        localTimers["scene5_3"] = timer.performWithDelay(5000, transition3)
        localTimers["scene5_4"] = timer.performWithDelay(6500, transition4)
        localTimers["scene5_5"] = timer.performWithDelay(9000, transition5)
        localTimers["scene5_6"] = timer.performWithDelay(11000, transition6)
        --localTimers["scene5_7"] = timer.performWithDelay(12000, transition7)
        
end
 
 
-----------------------------
-- GET STORYBOARD
-----------------------------
local function storyboard( w )
        if w == 1 then playFirst()
        elseif w == 2 then playSecond() 
        elseif w == 3 then playThird()
        elseif w == 4 then playFourth()
        elseif w == 5 then playFifth()
        end
end
-----------------------------
-- NEW FUNCTION
-----------------------------
new = function( params )
        myParams = params or nil
        storyboard(myParams.world)
        return sceneGroup
end

Someone ever solved a bus error ?
" exited abnormally with signal 10: Bus error active (but IDLE) sessions
"

No sorry. I ended up rewriting the whole thing and redoing all my images.

views:1979 update:2012/2/10 9:26:24
corona forums © 2003-2011