Skip to content

Commit e3280bb

Browse files
authored
Initialize sources loaded from save file before firing event (#914)
* Initialize sources loaded from save file before firing event Fixes a problem with video file sources loaded from a save file not having play/pause and scrubber controls
1 parent b97819a commit e3280bb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

core/src/main/java/edu/wpi/grip/core/serialization/SourceConverter.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,15 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co
5454
// are in the process of loading.
5555
final Source source = sourceFactory.create(sourceClass, properties);
5656

57-
// Instead of returning the source, post it to the event bus so both the core and GUI
58-
// classes know it
59-
// exists.
60-
eventBus.post(new SourceAddedEvent(source));
61-
6257
// Now that the source has been added it needs to be initialized
6358
// We do it safely here in case the source has changed in some way out
6459
// of our control. For example, if a webcam is no longer available.
6560
source.initializeSafely();
6661

62+
// Instead of returning the source, post it to the event bus so both the core and GUI
63+
// classes know it exists.
64+
eventBus.post(new SourceAddedEvent(source));
65+
6766
return null;
6867
} catch (IOException | RuntimeException ex) {
6968
throw new ConversionException("Error deserializing source", ex);

0 commit comments

Comments
 (0)