Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 05-01-2019, 03:26 PM   #1
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 5,265
Default Crash when setting track layouts from IReaperControlSurface::SetTrackTitle (FIXED)

Setting a track's TCP or MCP layout using GetSetMediaTrackInfo (or _String) from IReaperControlSurface::SetTrackTitle may crash REAPER when pressing Tab after renaming a track on Linux and macOS.

Also, on Linux and Windows, the position of the track name edit field is incorrect after changing the layout of the previous track:



This affects SWS Auto Layout (issues #911 and #1147).
  1. Create a bunch of tracks with the extension below loaded
  2. Open the track name edit field in the TCP or MCP
  3. Set name to 'a' and press Tab
  4. Repeat step 3 until it eventually crashes
Minimal extension code (extracted from what SWS does):
Code:
#define REAPERAPI_IMPLEMENT
#include "reaper_plugin_functions.h"

static class : public IReaperControlSurface {
  const char *GetTypeString() override { return ""; }
  const char *GetDescString() override { return ""; }
  const char *GetConfigString() override { return ""; }

  void SetTrackTitle(MediaTrack *track, const char *name) override
  {
    if(!strcmp(name, "a"))
      GetSetMediaTrackInfo(track, "P_TCP_LAYOUT", const_cast<char *>("Big Meter"));
  }
} g_timeSlice;

extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
  REAPER_PLUGIN_HINSTANCE instance, reaper_plugin_info_t *rec)
{
  if(!rec) {
    plugin_register("-csurf_inst", &g_timeSlice);
    return 0;
  }

  if(rec->caller_version != REAPER_PLUGIN_VERSION)
    return 0;
  
  GetSetMediaTrackInfo = (decltype(GetSetMediaTrackInfo))rec->GetFunc("GetSetMediaTrackInfo");
  plugin_register      = (decltype(plugin_register))     rec->GetFunc("plugin_register");

  plugin_register("csurf_inst", &g_timeSlice);

  return 1;
}
Code:
Thread 0 Crashed:: reaper  Dispatch queue: com.apple.main-thread
0   com.cockos.reaper	0x000000010038332d OpenEditDialog(MediaTrack*, WDL_VWnd*, HWND__*) + 141
1   com.cockos.reaper	0x0000000100594d6b MediaTrack::ControlProc(HWND__*, unsigned int, unsigned long, long) + 1531
2   com.cockos.reaper	0x000000010059474e MediaTrack::TrackCtlProc(HWND__*, unsigned int, unsigned long, long) + 94
3   com.cockos.reaper	0x000000010052a10c SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) + 364
4   com.cockos.reaper	0x0000000100526f1d -[REAPERSwell_hwnd onSwellMessage:p1:p2:] + 829
5   com.cockos.reaper	0x000000010054725a SendMessage(HWND__*, unsigned int, unsigned long, long) + 90
6   com.cockos.reaper	0x000000010058e889 Track_NameEdit_KBHook(MSG*) + 585
7   com.cockos.reaper	0x000000010037fe29 -[REAPERapp sendEvent:] + 2201
8   com.apple.AppKit 	0x00007fff8a8e1b68 -[NSApplication run] + 711
9   com.apple.AppKit 	0x00007fff8a85e244 NSApplicationMain + 1832
10  com.cockos.reaper	0x0000000100011b1c main + 28
11  com.cockos.reaper	0x0000000100011ae4 start + 52
Code:
#0  0x0000014b0000012a in  ()
#1  0x00000000004a1e6d in  ()
#2  0x00000000004b87ce in  ()
#3  0x00007ffff794224f in SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) (hwnd=0x101edb0, uMsg=273, wParam=66573, lParam=0) at swell-wnd-generic.cpp:6615
#4  0x00007ffff792c27e in SendMessage(HWND__*, unsigned int, unsigned long, long) (hwnd=0x101edb0, msg=273, wParam=66573, lParam=0) at swell-wnd-generic.cpp:307
#5  0x00000000004a1aa2 in  ()
#6  0x00000000009fa80a in SWELLAppMain ()
#7  0x00007ffff79637eb in SWELLAppMain(int, INT_PTR, INT_PTR) (msg=256, parm1=140737488344800, parm2=0) at swell-appstub-generic.cpp:80
#8  0x00007ffff795e4b9 in OnKeyEvent(GdkEventKey*) (k=0xf76de0) at swell-generic-gdk.cpp:1010
#9  0x00007ffff795f6aa in swell_gdkEventHandler(GdkEvent*, gpointer) (evt=0xf76de0, data=0x0) at swell-generic-gdk.cpp:1378
#10 0x00007ffff7847c86 in  () at /usr/lib/libgdk-3.so.0
#11 0x00007ffff7879ab5 in  () at /usr/lib/libgdk-3.so.0
#12 0x00007ffff75437bf in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#13 0x00007ffff7545739 in  () at /usr/lib/libglib-2.0.so.0
#14 0x00007ffff754577e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#15 0x00007ffff795fa2d in SWELL_RunEvents() () at swell-generic-gdk.cpp:1512
#16 0x00007ffff792d568 in SWELL_RunMessageLoop() () at swell-wnd-generic.cpp:772
#17 0x0000000000413076 in  ()
#18 0x00007ffff79e3ce3 in __libc_start_main () at /usr/lib/libc.so.6
#19 0x000000000041865a in _start ()

Last edited by cfillion; 05-01-2019 at 07:08 PM.
cfillion is offline   Reply With Quote
Old 05-01-2019, 04:33 PM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

Ah thanks, a stale pointer being used. Fixing!
Justin is offline   Reply With Quote
Old 05-01-2019, 07:30 PM   #3
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 5,265
Default

Thank you!
cfillion is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.