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

Fix crash on MacOS when clicking filament dropdown in object list #3205

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "/O2")
string(REGEX REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-O2")
string(REGEX REPLACE "-O2" "-O0" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()

if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-O2")
string(REGEX REPLACE "-O2" "-O0" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
endif()

if(MSVC)
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "/Ob1")
string(REGEX REPLACE "/Ob1" "/Ob0" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
Expand Down
15 changes: 9 additions & 6 deletions src/slic3r/GUI/GUI_ObjectList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5533,12 +5533,6 @@ void GUI::ObjectList::OnStartEditing(wxDataViewEvent &event)
// Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column.
void ObjectList::OnEditingStarted(wxDataViewEvent &event)
{
// Orca: Automatically show drop down on editing start and finish editing when the combobox is closed
if (event.GetColumn() == colFilament) {
::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl());
c->ToggleDropDown();
c->Bind(wxEVT_COMBOBOX_CLOSEUP, [event](wxCommandEvent& evt){ event.GetDataViewColumn()->GetRenderer()->FinishEditing(); });
}
#ifdef __WXMSW__
m_last_selected_column = -1;
#else
Expand Down Expand Up @@ -5603,6 +5597,15 @@ void ObjectList::OnEditingStarted(wxDataViewEvent &event)
SetCustomRendererPtr(dynamic_cast<wxDataViewCustomRenderer*>(renderer));
#endif
#endif //__WXMSW__

// Orca: Automatically show drop down on editing start and finish editing when the combobox is closed
// Note: this must placed AFTER the above `renderer->StartEditing` call, otherwise `c` will be nullptr on MacOS,
// due to the code in MacDarkMode.mm
if (event.GetColumn() == colFilament) {
::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl());
c->ToggleDropDown();
c->Bind(wxEVT_COMBOBOX_CLOSEUP, [event](wxCommandEvent& evt){ event.GetDataViewColumn()->GetRenderer()->FinishEditing(); });
}
}

void ObjectList::OnEditingDone(wxDataViewEvent &event)
Expand Down