Skip to content

Commit a601aa2

Browse files
committed
MapEditorController: Basic fix for map parts UI
When creating a new map with touch mode enabled, Mapper crashed due to uninitialized map part UI components. This is just a minimal fix for now, to minimize risk of side effects. In the end, the controller state and UI setup will need much more work.
1 parent 2b8d329 commit a601aa2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/gui/map/map_editor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ MapEditorController::~MapEditorController()
318318
delete mappart_merge_act;
319319
delete mappart_merge_menu;
320320
delete mappart_move_menu;
321+
if (mappart_selector_box)
322+
delete mappart_selector_box;
321323
for (TemplatePositionDockWidget* widget : qAsConst(template_position_widgets))
322324
delete widget;
323325
delete gps_display;
@@ -3915,11 +3917,11 @@ void MapEditorController::setMapAndView(Map* map, MapView* map_view)
39153917
{
39163918
this->map->disconnect(symbol_widget);
39173919
}
3918-
updateMapPartsUI();
39193920
}
39203921

39213922
this->map = map;
39223923
this->main_view = map_view;
3924+
updateMapPartsUI();
39233925

39243926
connect(&map->undoManager(), &UndoManager::canRedoChanged, this, &MapEditorController::undoStepAvailabilityChanged);
39253927
connect(&map->undoManager(), &UndoManager::canUndoChanged, this, &MapEditorController::undoStepAvailabilityChanged);

src/gui/map/map_editor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ protected slots:
793793
QToolBar* toolbar_drawing;
794794
QToolBar* toolbar_editing;
795795
QToolBar* toolbar_advanced_editing;
796-
QToolBar* toolbar_mapparts;
796+
QToolBar* toolbar_mapparts = nullptr;
797797

798798
// For mobile UI
799799
ActionGridBar* bottom_action_bar;
@@ -802,7 +802,7 @@ protected slots:
802802
QAction* mobile_symbol_selector_action;
803803
QMenu* mobile_symbol_button_menu;
804804

805-
QComboBox* mappart_selector_box;
805+
QPointer<QComboBox> mappart_selector_box;
806806

807807
QScopedPointer<GeoreferencingDialog> georeferencing_dialog;
808808
QScopedPointer<ReopenTemplateDialog> reopen_template_dialog;

0 commit comments

Comments
 (0)