@@ -80,16 +80,14 @@ import androidx.compose.ui.window.DialogProperties
8080import androidx.lifecycle.viewmodel.compose.viewModel
8181import coil3.compose.AsyncImage
8282import java.time.OffsetDateTime
83+ import kotlinx.coroutines.CancellationException
8384import kotlinx.coroutines.Dispatchers
8485import kotlinx.coroutines.launch
85- import kotlinx.coroutines.withContext
8686import org.schabi.newpipe.R
8787import org.schabi.newpipe.error.ErrorInfo
8888import org.schabi.newpipe.error.ErrorUtil
8989import org.schabi.newpipe.error.UserAction.LONG_PRESS_MENU_ACTION
9090import org.schabi.newpipe.extractor.stream.StreamType
91- import org.schabi.newpipe.player.helper.PlayerHolder
92- import org.schabi.newpipe.ui.components.common.ScaffoldWithToolbar
9391import org.schabi.newpipe.ui.components.menu.LongPressAction.Type.EnqueueNext
9492import org.schabi.newpipe.ui.components.menu.LongPressAction.Type.ShowChannelDetails
9593import org.schabi.newpipe.ui.discardAllTouchesIf
@@ -122,7 +120,7 @@ fun getLongPressMenuView(
122120 LongPressMenu (
123121 longPressable = longPressable,
124122 longPressActions = longPressActions,
125- onDismissRequest = { (this .parent as ViewGroup ).removeView(this ) }
123+ onDismissRequest = { (this .parent as ? ViewGroup )? .removeView(this ) }
126124 )
127125 }
128126 }
@@ -173,6 +171,8 @@ fun LongPressMenu(
173171 coroutineScope.launch {
174172 try {
175173 action.action(ctx)
174+ } catch (_: CancellationException ) {
175+ // the user canceled the action, e.g. by dismissing the dialog while loading
176176 } catch (t: Throwable ) {
177177 ErrorUtil .showSnackbar(
178178 ctx,
0 commit comments