Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c929116

Browse files
committed
[[ Bug 12481 ]] MCplayers list now all currently loaded players on Mac.
[[ Bug 12481 ]] Hide/Show does not playstop/prepare movie.
1 parent e331df0 commit c929116

4 files changed

Lines changed: 41 additions & 20 deletions

File tree

docs/notes/bugfix-12481.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Various actions on players (such as hiding and showing) prevent it from working properly.

engine/src/desktop-stack.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ void MCStack::stop_externals()
251251

252252
MCPlayer *tptr = MCplayers;
253253

254+
#ifdef FEATURE_PLATFORM_PLAYER
255+
while(tptr != NULL)
256+
{
257+
if (tptr -> getstack() == this)
258+
tptr -> playstop();
259+
tptr = tptr -> getnextplayer();
260+
}
261+
#else
254262
while (tptr != NULL)
255263
{
256264
if (tptr->getstack() == this)
@@ -261,6 +269,7 @@ void MCStack::stop_externals()
261269
else
262270
tptr = tptr->getnextplayer();
263271
}
272+
#endif
264273
destroywindowshape();
265274

266275
MClockmessages = oldlock;

engine/src/mac-qt-player.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ inline NSComparisonResult do_QTTimeCompare (QTTime time, QTTime otherTime)
310310
t_player -> m_current_frame = nil;
311311
}
312312
SetMovieDrawingCompleteProc([t_player -> m_movie quickTimeMovie], movieDrawingCallWhenChanged, nil, nil);
313-
313+
314314
// Switching to non-offscreen
315315
t_player -> m_offscreen = t_player -> m_pending_offscreen;
316316
t_player -> Realize();
@@ -435,6 +435,7 @@ inline NSComparisonResult do_QTTimeCompare (QTTime time, QTTime otherTime)
435435
m_movie = t_new_movie;
436436

437437
[[NSNotificationCenter defaultCenter] removeObserver: m_observer];
438+
438439
extern NSString **QTMovieDidEndNotification_ptr;
439440
[[NSNotificationCenter defaultCenter] addObserver: m_observer selector:@selector(movieFinished:) name: *QTMovieDidEndNotification_ptr object: m_movie];
440441

@@ -557,6 +558,7 @@ inline NSComparisonResult do_QTTimeCompare (QTTime time, QTTime otherTime)
557558

558559
void MCQTKitPlayer::UnlockBitmap(MCImageBitmap *bitmap)
559560
{
561+
delete bitmap -> data;
560562
delete bitmap;
561563
}
562564

engine/src/player-platform.cpp

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@ MCPlayer::MCPlayer()
539539
m_show_volume = false;
540540
m_scrub_back_is_pressed = false;
541541
m_scrub_forward_is_pressed = false;
542+
543+
// MW-2014-07-16: [[ Bug ]] Put the player in the list.
544+
nextplayer = MCplayers;
545+
MCplayers = this;
542546
}
543547

544548
MCPlayer::MCPlayer(const MCPlayer &sref) : MCControl(sref)
@@ -571,6 +575,10 @@ MCPlayer::MCPlayer(const MCPlayer &sref) : MCControl(sref)
571575
m_show_volume = false;
572576
m_scrub_back_is_pressed = false;
573577
m_scrub_forward_is_pressed = false;
578+
579+
// MW-2014-07-16: [[ Bug ]] Put the player in the list.
580+
nextplayer = MCplayers;
581+
MCplayers = this;
574582
}
575583

576584
MCPlayer::~MCPlayer()
@@ -581,6 +589,22 @@ MCPlayer::~MCPlayer()
581589

582590
playstop();
583591

592+
// MW-2014-07-16: [[ Bug ]] Remove the player from the player's list.
593+
if (MCplayers != NULL)
594+
{
595+
if (MCplayers == this)
596+
MCplayers = nextplayer;
597+
else
598+
{
599+
MCPlayer *tptr = MCplayers;
600+
while (tptr->nextplayer != NULL && tptr->nextplayer != this)
601+
tptr = tptr->nextplayer;
602+
if (tptr->nextplayer == this)
603+
tptr->nextplayer = nextplayer;
604+
}
605+
}
606+
nextplayer = NULL;
607+
584608
if (m_platform_player != nil)
585609
MCPlatformPlayerRelease(m_platform_player);
586610

@@ -1281,6 +1305,7 @@ Exec_stat MCPlayer::setprop(uint4 parid, Properties p, MCExecPoint &ep, Boolean
12811305
MCeerror->add(EE_OBJECT_NAN, 0, 0, data);
12821306
return ES_ERROR;
12831307
}
1308+
12841309
if (m_platform_player != nil)
12851310
MCPlatformSetPlayerProperty(m_platform_player, kMCPlatformPlayerPropertyQTVRZoom, kMCPlatformPropertyTypeDouble, &zoom);
12861311

@@ -1293,25 +1318,12 @@ Exec_stat MCPlayer::setprop(uint4 parid, Properties p, MCExecPoint &ep, Boolean
12931318
{
12941319
uint4 oldflags = flags;
12951320
Exec_stat stat = MCControl::setprop(parid, p, ep, effective);
1296-
if (flags != oldflags && !(flags & F_VISIBLE))
1297-
playstop();
1321+
12981322
if (m_platform_player != nil)
12991323
{
13001324
bool t_visible;
13011325
t_visible = getflag(F_VISIBLE);
13021326
MCPlatformSetPlayerProperty(m_platform_player, kMCPlatformPlayerPropertyVisible, kMCPlatformPropertyTypeBool, &t_visible);
1303-
1304-
// PM-2014-07-09: [[ Bug 12731 ]] Hiding and showing resized player preserves its size (and the position of the controller thumb, if it is paused)
1305-
if (t_visible)
1306-
{
1307-
MCPlatformAttachPlayer(m_platform_player, getstack() -> getwindow());
1308-
layer_redrawall();
1309-
state |= CS_PREPARED | CS_PAUSED;
1310-
{
1311-
nextplayer = MCplayers;
1312-
MCplayers = this;
1313-
}
1314-
}
13151327
}
13161328

13171329
return stat;
@@ -1674,10 +1686,6 @@ Boolean MCPlayer::prepare(const char *options)
16741686
if (ok)
16751687
{
16761688
state |= CS_PREPARED | CS_PAUSED;
1677-
{
1678-
nextplayer = MCplayers;
1679-
MCplayers = this;
1680-
}
16811689
}
16821690

16831691
return ok;
@@ -1755,6 +1763,7 @@ Boolean MCPlayer::playstop()
17551763

17561764
freetmp();
17571765

1766+
/*
17581767
if (MCplayers != NULL)
17591768
{
17601769
if (MCplayers == this)
@@ -1768,7 +1777,7 @@ Boolean MCPlayer::playstop()
17681777
tptr->nextplayer = nextplayer;
17691778
}
17701779
}
1771-
nextplayer = NULL;
1780+
nextplayer = NULL;*/
17721781

17731782
if (disposable)
17741783
{

0 commit comments

Comments
 (0)