diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 493750b3..32120cff 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1176,8 +1176,16 @@ static iBool requestMedia_DocumentWidget_(iDocumentWidget *d, iGmLinkId linkId) | |||
1176 | 1176 | ||
1177 | static iBool handleMediaCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) { | 1177 | static iBool handleMediaCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) { |
1178 | iMediaRequest *req = pointerLabel_Command(cmd, "request"); | 1178 | iMediaRequest *req = pointerLabel_Command(cmd, "request"); |
1179 | if (!req || req->doc != d) { | 1179 | iBool isOurRequest = iFalse; |
1180 | return iFalse; /* not our request */ | 1180 | /* This request may already be deleted so treat the pointer with caution. */ |
1181 | iConstForEach(ObjectList, m, d->media) { | ||
1182 | if (m.object == req) { | ||
1183 | isOurRequest = iTrue; | ||
1184 | break; | ||
1185 | } | ||
1186 | } | ||
1187 | if (!isOurRequest) { | ||
1188 | return iFalse; | ||
1181 | } | 1189 | } |
1182 | if (equal_Command(cmd, "media.updated")) { | 1190 | if (equal_Command(cmd, "media.updated")) { |
1183 | /* Pass new data to media players. */ | 1191 | /* Pass new data to media players. */ |
@@ -2040,7 +2048,18 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2040 | if (!requestMedia_DocumentWidget_(d, linkId)) { | 2048 | if (!requestMedia_DocumentWidget_(d, linkId)) { |
2041 | if (linkFlags & content_GmLinkFlag) { | 2049 | if (linkFlags & content_GmLinkFlag) { |
2042 | /* Dismiss shown content on click. */ | 2050 | /* Dismiss shown content on click. */ |
2043 | setData_Media(media_GmDocument(d->doc), linkId, NULL, NULL, allowHide_MediaFlag); | 2051 | setData_Media(media_GmDocument(d->doc), |
2052 | linkId, | ||
2053 | NULL, | ||
2054 | NULL, | ||
2055 | allowHide_MediaFlag); | ||
2056 | /* Cancel a partially received request. */ { | ||
2057 | iMediaRequest *req = findMediaRequest_DocumentWidget_(d, linkId); | ||
2058 | if (!isFinished_GmRequest(req->req)) { | ||
2059 | cancel_GmRequest(req->req); | ||
2060 | removeMediaRequest_DocumentWidget_(d, linkId); | ||
2061 | } | ||
2062 | } | ||
2044 | redoLayout_GmDocument(d->doc); | 2063 | redoLayout_GmDocument(d->doc); |
2045 | d->hoverLink = NULL; | 2064 | d->hoverLink = NULL; |
2046 | scroll_DocumentWidget_(d, 0); | 2065 | scroll_DocumentWidget_(d, 0); |