Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on newly added Source Effect Sort #4374

Closed
cybercop23 opened this issue Feb 27, 2024 · 3 comments
Closed

Crash on newly added Source Effect Sort #4374

cybercop23 opened this issue Feb 27, 2024 · 3 comments

Comments

@cybercop23
Copy link
Collaborator

With PR #4370 you can now sort the Source Sequence Efects count; before when you clicked it it did nothing, only the model name was sortable.

On a Mac importing from a ZIP file, once you click on the effects column to sort it xlights crashes.

Additionally, both ZIP and non-zip, the list never actually gets sorted when sorting by the effect count.

All of those things work w/o an issue in Wondows.

`Crashed Thread ID: 0x1de3f1c40 (Main Thread)

0 xLights 0x00000001014a42ec _ZN14xlCrashHandler11HandleCrashEbRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 3288
1 xLights 0x000000010208a4e4 _ZN9xlBaseApp16OnFatalExceptionEv + 88
2 xLights 0x00000001022a3c14 _ZL20wxFatalSignalHandleri + 36
3 libsystem_platform.dylib 0x0000000187b4da24 _sigtramp + 56
4 xLights 0x000000010232020c _ZNK14wxListItemData7GetItemER10wxListItem + 60
5 xLights 0x0000000102334200 _ZNSt3__111__introsortINS_17_ClassicAlgPolicyER20wxListLineComparatorP14wxListLineDataEEvT1_S6_T0_NS_15iterator_traitsIS6_E15difference_typeE + 864
6 xLights 0x000000010232f464 _ZN16wxListMainWindow9SortItemsEPFilllEl + 196
7 xLights 0x0000000101fa07e4 _ZN29xLightsImportChannelMapDialog31OnListCtrl_AvailableColumnClickER11wxListEvent + 268
8 xLights 0x00000001022a7d14 _ZN12wxEvtHandler23SearchDynamicEventTableER7wxEvent + 112
9 xLights 0x00000001022a7bb8 _ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent + 88
10 xLights 0x00000001022a79dc _ZN12wxEvtHandler12ProcessEventER7wxEvent + 56
11 xLights 0x0000000102446e38 _ZN12wxWindowBase8TryAfterER7wxEvent + 128
12 xLights 0x0000000102446e38 _ZN12wxWindowBase8TryAfterER7wxEvent + 128
13 xLights 0x0000000102446e38 _ZN12wxWindowBase8TryAfterER7wxEvent + 128
14 xLights 0x00000001024676e4 _ZN24wxScrollHelperEvtHandler12ProcessEventER7wxEvent + 56
15 xLights 0x0000000102322eac _ZN18wxListHeaderWindow13SendListEventEiRK7wxPoint + 232
16 xLights 0x000000010232278c _ZN18wxListHeaderWindow7OnMouseER12wxMouseEvent + 1292
17 xLights 0x00000001022a7080 _ZN16wxEventHashTable11HandleEventER7wxEventP12wxEvtHandler + 1148
18 xLights 0x00000001022a7bd8 _ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent + 120
19 xLights 0x00000001022a79dc _ZN12wxEvtHandler12ProcessEventER7wxEvent + 56
20 xLights 0x000000010236aa20 _ZN17wxWidgetCocoaImpl18DoHandleMouseEventEP7NSEvent + 180
21 xLights 0x0000000102364440 _ZN17wxWidgetCocoaImpl10mouseEventEP7NSEventP6NSViewPv + 176
22 AppKit 0x000000018b578c6c -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472
23 AppKit 0x000000018b5043ec -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
24 AppKit 0x000000018b5040ac -[NSWindow(NSEventRouting) sendEvent:] + 284
25 xLights 0x000000010234e7ec -[wxNSPanel sendEvent:] + 116
26 AppKit 0x000000018bbc2f60 -[NSApplication(NSEventRouting) sendEvent:] + 1604
27 xLights 0x00000001022c7bb0 -[wxNSApplication sendEvent:] + 84
28 AppKit 0x000000018b60b224 -[NSApplication _doModalLoop:peek:] + 276
29 AppKit 0x000000018b8141b8 __33-[NSApplication runModalSession:]_block_invoke_2 + 88
30 AppKit 0x000000018b814144 __33-[NSApplication runModalSession:]_block_invoke + 112
31 AppKit 0x000000018b609968 _NSTryRunModal + 100
32 AppKit 0x000000018b814014 -[NSApplication runModalSession:] + 148
33 xLights 0x00000001023446bc _ZN14wxGUIEventLoop17DoDispatchTimeoutEm + 64
34 xLights 0x0000000102293958 _ZN13wxCFEventLoop15DispatchTimeoutEm + 44
35 xLights 0x0000000102293a50 _ZN13wxCFEventLoop8OSXDoRunEv + 132
36 xLights 0x0000000102344a68 _ZN16wxModalEventLoop8OSXDoRunEv + 88
37 xLights 0x0000000102293bac _ZN13wxCFEventLoop5DoRunEv + 40
38 xLights 0x00000001022cad78 _ZN8wxDialog9ShowModalEv + 268
39 xLights 0x0000000101c02708 _ZN12xLightsFrame13ImportXLightsER16SequenceElementsRKNSt3__16vectorIP7ElementNS2_9allocatorIS5_EEEER15SequencePackagebbbbRKNS2_12basic_stringIcNS2_11char_traitsIcEENS6_IcEEEE + 12460
40 xLights 0x0000000101bf7e44 _ZN12xLightsFrame13ImportXLightsERK10wxFileNameRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 968
41 xLights 0x0000000101bebbdc _ZN12xLightsFrame23OnMenuItemImportEffectsER14wxCommandEvent + 5080
42 xLights 0x00000001022a7d14 _ZN12wxEvtHandler23SearchDynamicEventTableER7wxEvent + 112
43 xLights 0x00000001022a7aa0 _ZN12wxEvtHandler12ProcessEventER7wxEvent + 252
44 xLights 0x00000001022a7c44 _ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent + 228
45 xLights 0x00000001022a79dc _ZN12wxEvtHandler12ProcessEventER7wxEvent + 56
46 xLights 0x0000000102446e38 _ZN12wxWindowBase8TryAfterER7wxEvent + 128
47 xLights 0x000000010240aae0 _ZN10wxMenuBase14DoProcessEventEPS_R7wxEventP8wxWindow + 252
48 xLights 0x000000010240a968 _ZN10wxMenuBase9SendEventEii + 196
49 xLights 0x000000010234c408 -[wxNSMenuItem clickedAction:] + 216
50 AppKit 0x000000018b57df44 -[NSApplication(NSResponder) sendAction:to:from:] + 460
51 AppKit 0x000000018b6476c8 -[NSMenuItem _corePerformAction] + 372
52 AppKit 0x000000018bbee0e4 _NSMenuPerformActionWithHighlighting + 152
53 AppKit 0x000000018b67fa70 -[NSMenu performActionForItemAtIndex:] + 200
54 AppKit 0x000000018b67f990 -[NSMenu _internalPerformActionForItemAtIndex:] + 76
55 AppKit 0x000000018bbe4b78 +[NSCocoaMenuImpl _performActionForMenuItem:] + 84
56 AppKit 0x000000018ba0eec4 -[NSMenuTrackingSession _performPostTrackingDismissalActions] + 276
57 AppKit 0x000000018ba0ec64 -[NSMenuTrackingSession startRunningMenuEventLoop:] + 836
58 AppKit 0x000000018bab51d4 -[NSMenuBarTrackingSession _mouseDownEventHandler:] + 248
59 AppKit 0x000000018bab50c4 -[NSMenuBarTrackingSession handleEvent:] + 248
60 AppKit 0x000000018bab4fa4 __57-[NSMenuBarTrackingSession _addLocalEventMonitorIfNeeded]_block_invoke + 192
61 AppKit 0x000000018b5d3a04 _NSSendEventToDequeuingObservers + 252
62 AppKit 0x000000018bbc44f4 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2260
63 AppKit 0x000000018b3cc37c -[NSApplication run] + 476
64 xLights 0x000000010234484c _ZN14wxGUIEventLoop8OSXDoRunEv + 112
65 xLights 0x0000000102293bac _ZN13wxCFEventLoop5DoRunEv + 40
66 xLights 0x0000000102224b5c _ZN15wxEventLoopBase3RunEv + 120
67 xLights 0x0000000102206e3c _ZN16wxAppConsoleBase8MainLoopEv + 120
68 xLights 0x0000000102303288 _ZN5wxApp5OnRunEv + 64
69 xLights 0x000000010224cafc _Z7wxEntryRiPPw + 100
70 xLights 0x00000001020854d4 main + 692
71 dyld 0x000000018779d0e0 start + 2360

`

@derwin12
Copy link
Collaborator

What should I look for in a mac vs windows crash? Something in the types?

@derwin12
Copy link
Collaborator

Thoughts on this? And changing "auto" to "int"?
image

@dkulp
Copy link
Member

dkulp commented Feb 27, 2024

This should now be fixed. Problem was definitely more serious than expected and has existed since December. For one, GettemText takes the index/position, but the wxIntPtr is NOT the index. During sort, the the index of the items changes as they sort. Using FindItem ALMOST works, but the std::sort algorithm on Mac will move to an insertion sort at a certain size and it does that by saving an item to a temporary using std::move which results in an item in the list NOT having any data so FindItem then crashes.

In any case, the docs for the SortItems call specifically says "Notice that the control may only be sorted on client data associated with the items, so you must use SetItemData if you want to be able to sort the items in the control." so I've updated the sorts to only use that.

@dkulp dkulp closed this as completed Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants