Skip to content

Commit 54f072b

Browse files
GeertJohanPierre Champion
authored and
Pierre Champion
committed
Assert that EngineOpenGL was created using NewEngineOpenGL (#73)
1 parent 3fbde07 commit 54f072b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flutter/flutter.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ func (flu *EngineOpenGL) Index() int {
8282

8383
// Run launches the Flutter Engine in a background thread.
8484
func (flu *EngineOpenGL) Run(window uintptr, vmArgs []string) Result {
85+
// validate this EngineOpenGL was created correctly
86+
flutterEnginesLock.RLock()
87+
if len(flutterEngines) <= flu.index || flutterEngines[flu.index] != flu {
88+
panic("EngineOpenGL was wrongly created. Use embedder.NewEngineOpenGL().")
89+
}
90+
flutterEnginesLock.RUnlock()
91+
8592
args := C.FlutterProjectArgs{
8693
assets_path: C.CString(flu.AssetsPath),
8794
icu_data_path: C.CString(flu.IcuDataPath),

0 commit comments

Comments
 (0)