Fix wrong document showing after session restore

Since documents are loaded asynchronously and we trigger a request for the first tab’s document, this might finish loading after the selected tab’s document, hence trigger a setDocument: after we loaded the selected document’s tab.
This commit is contained in:
Allan Odgaard
2012-09-18 19:32:32 +02:00
parent 48616a7ea1
commit 361d2daa5b

View File

@@ -259,6 +259,10 @@ namespace
- (void)documentOpenHelper:(DocumentOpenHelper*)documentOpenHelper didOpenDocument:(document::document_ptr const&)aDocument
{
[documentOpenHelper autorelease];
if(aDocument != [self selectedDocument])
return;
iterate(tab, documentTabs)
{
if(**tab == aDocument && !(*tab)->_did_open)
@@ -273,7 +277,6 @@ namespace
[documentView setDocument:aDocument];
[self makeTextViewFirstResponder:self];
[documentOpenHelper release];
}
- (void)documentOpenHelper:(DocumentOpenHelper*)documentOpenHelper failedToOpenDocument:(document::document_ptr const&)aDocument error:(std::string const&)aMessage usingFilter:(oak::uuid_t const&)filterUUID