fix crash at startup caused by use of null session ptr to set end marker (from 2.0)

git-svn-id: svn://localhost/ardour2/branches/3.0@3975 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2008-10-16 11:16:41 +00:00
parent 1bca6b5c74
commit 3d47c31d8f
2 changed files with 8 additions and 2 deletions

View File

@@ -1169,6 +1169,10 @@ Editor::center_screen_internal (nframes64_t frame, float page)
void
Editor::handle_new_duration ()
{
if (!session) {
return;
}
ENSURE_GUI_THREAD (mem_fun (*this, &Editor::handle_new_duration));
nframes64_t new_end = session->get_maximum_extent() + (nframes64_t) floorf (current_page_frames() * 0.10f);
@@ -1176,6 +1180,7 @@ Editor::handle_new_duration ()
if (new_end > last_canvas_frame) {
last_canvas_frame = new_end;
horizontal_adjustment.set_upper (last_canvas_frame / frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
//reset_scrolling_region ();
}
@@ -1324,6 +1329,7 @@ Editor::connect_to_session (Session *t)
sfbrowser->set_session (session);
}
last_canvas_frame = 0; // force update in handle_new_duration()
handle_new_duration ();
redisplay_regions ();

View File

@@ -342,8 +342,8 @@ Editor::track_canvas_size_allocated ()
}
}
horizontal_adjustment.set_upper (session->current_end_frame()/frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
handle_new_duration ();
reset_hscrollbar_stepping ();
update_fixed_rulers();
redisplay_tempo (false);