View Single Post
Old 01-20-2017, 01:53 PM   #1
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default [Lua] Main_OnCommand(41898) crashes REAPER (FIXED)

Running the action "ReaScript: Close all running ReaScripts" from a Lua script can crash REAPER.

Crash #1

When running this code from the IDE via Ctrl+S (it works fine from the Action List):
Code:
reaper.Main_OnCommand(41898, 0)
Code:
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000030

VM Regions Near 0x30:
--> 
    __TEXT                 0000000100000000-0000000100a1a000 [ 10.1M] r-x/rwx SM=COW  /Users/USER/*/REAPER64.app/Contents/MacOS/REAPER

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.cockos.reaper             	0x00000001006398f6 ReaScript_Instance::editorProc(HWND__*, unsigned int, unsigned long, long) + 9254
1   com.cockos.reaper             	0x00000001006374af ReaScriptEditorProc(HWND__*, unsigned int, unsigned long, long) + 111
2   com.cockos.reaper             	0x000000010049c06c SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) + 364
3   com.cockos.reaper             	0x00000001004946f9 -[REAPERSwell_hwnd SWELL_Timer:] + 137
4   com.apple.Foundation          	0x00007fff960b3a23 __NSFireTimer + 95
5   com.apple.CoreFoundation      	0x00007fff938442e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
6   com.apple.CoreFoundation      	0x00007fff93843f73 __CFRunLoopDoTimer + 1059
7   com.apple.CoreFoundation      	0x00007fff938b753d __CFRunLoopDoTimers + 301
8   com.apple.CoreFoundation      	0x00007fff937ff608 __CFRunLoopRun + 2024
9   com.apple.CoreFoundation      	0x00007fff937febd8 CFRunLoopRunSpecific + 296
10  com.apple.HIToolbox           	0x00007fff9670156f RunCurrentEventLoopInMode + 235
11  com.apple.HIToolbox           	0x00007fff967012ea ReceiveNextEventCommon + 431
12  com.apple.HIToolbox           	0x00007fff9670112b _BlockUntilNextEventMatchingListInModeWithFilter + 71
13  com.apple.AppKit              	0x00007fff888ac8ab _DPSNextEvent + 978
14  com.apple.AppKit              	0x00007fff888abe58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
15  com.apple.AppKit              	0x00007fff888a1af3 -[NSApplication run] + 594
16  com.apple.AppKit              	0x00007fff8881e244 NSApplicationMain + 1832
17  com.cockos.reaper             	0x000000010001154c main + 28
18  com.cockos.reaper             	0x0000000100011514 start + 52
Crash #2

This one crashes REAPER when ran either from the Action List or from the IDE:

Code:
reaper.defer(function()
  reaper.Main_OnCommand(41898, 0)
end)
Code:
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.cockos.reaper             	0x00000001007adffb luaV_execute + 75
1   com.cockos.reaper             	0x000000010077f2fc luaD_callnoyield + 92
2   com.cockos.reaper             	0x00000001007684b2 f_call + 18
3   com.cockos.reaper             	0x0000000100780f50 luaD_rawrunprotected + 112
4   com.cockos.reaper             	0x000000010078113c luaD_pcall + 76
5   com.cockos.reaper             	0x0000000100768558 lua_pcallk + 152
6   com.cockos.reaper             	0x00000001007e73d4 LuaAPI::RunDeferredTask(HWND__*) + 372
7   com.cockos.reaper             	0x000000010064c1aa ReaScript_RunDeferred() + 250
8   com.cockos.reaper             	0x00000001000b29bd runMiscTimers() + 2477
9   com.cockos.reaper             	0x00000001000b140a Main_OnTimer(HWND__*, unsigned long) + 138
10  com.cockos.reaper             	0x00000001005af288 MainProc(HWND__*, unsigned int, unsigned long, long) + 7832
11  ???                           	0x5fbfd46000000001 0 + 6899466662936838145

Last edited by cfillion; 01-20-2017 at 06:44 PM.
cfillion is offline   Reply With Quote