Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when dispose() is called on 0.1.2 and 0.1.3 #103

Closed
Zarainia opened this issue Aug 12, 2021 · 2 comments
Closed

Crash when dispose() is called on 0.1.2 and 0.1.3 #103

Zarainia opened this issue Aug 12, 2021 · 2 comments
Labels
bug Something isn't working critical The bug has high priority

Comments

@Zarainia
Copy link

Consider this code where the player is used in a dialog:

import 'package:dart_vlc/dart_vlc.dart';
import 'package:flutter/material.dart';

void main() {
  DartVLC.initialize();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.light(),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Test"),
        ),
        body: Column(
          children: [AppButton()],
        ),
      ),
    );
  }
}

class AppButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialButton(onPressed: () {
      showDialog(context: context, builder: (context) => AlertDialog(content: SoundTest()));
    }, child: Text("Open"),);
  }
}

class SoundTest extends StatefulWidget {
  @override
  _SoundTestState createState() => _SoundTestState();
}

class _SoundTestState extends State<SoundTest> {
  late Player player;

  @override
  void dispose() {
    player.dispose();
    super.dispose();
  }

  @override
  void initState() {
    super.initState();
    player = Player(id: 1);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialButton(onPressed: (){}, child: Text("Play"),);
  }
}

Calling dispose() on the Player (eg., to clean up when the dialog widget itself is disposed) causes the app to crash with no message. This did not use to happen before 0.1.1.

@alexmercerind alexmercerind added bug Something isn't working critical The bug has high priority labels Aug 12, 2021
@alexmercerind
Copy link
Owner

First of all, big thanks for giving a running reproducible example. Very rare to see in non-moderated issues.

This issue is fixed in #104.

Will close this, once merged.

@alexmercerind
Copy link
Owner

Fixed on master. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical The bug has high priority
Projects
None yet
Development

No branches or pull requests

2 participants