Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10920 closed enhancement (fixed)

[patch] Stop image thumbnail loading if thumbnails are not shown

Reported by: holgermappt Owned by: bastiK
Priority: minor Milestone: 15.01
Component: Core image mapping Version:
Keywords: Cc: bastiK

Description (last modified by holgermappt)

Here is a patch that adds the function stopLoadThumbs() that stops geo image thumbnail loading if thumbnails are not needed anymore. The thumbnail load is continued the next time loadThumbs() is called. The JOSM revision needs to be inserted for function stopLoadThumbs() (@since tbd).

Please review the thread synchronization, my experience in that area is limited. I think a new thumbnail loader should wait if another loader is still running, but such an implementation might be too complicated compared to the actual problem.

One corner case is a sequence of setUseThumbs(true); setUseThumbs(false); setUseThumbs(true); .... That would start multiple threads, each thread with a new ThumbsLoader instance. They potentially all work on the same image in parallel. Most of the loaders will stop after they processed one file.

An other corner case is a layer merge while thumbnails are loaded. The thumbnail loaders are stopped on both layers in that case. thumbsLoaded will be false in that case and the next paint() will continue to load thumbnails if useThumbs is true.

The patch originates from ticket:10854.

Attachments (1)

GeoImageLayer_stopLoadThumbs.patch (3.0 KB ) - added by holgermappt 10 years ago.
Patch file for this ticket

Download all attachments as: .zip

Change History (8)

comment:1 by stoecker, 10 years ago

Summary: Stop image thumbnail loading if thumbnails are not shown[patch] Stop image thumbnail loading if thumbnails are not shown

by holgermappt, 10 years ago

Patch file for this ticket

comment:2 by holgermappt, 10 years ago

Description: modified (diff)

comment:3 by Don-vip, 10 years ago

Cc: bastiK added

@bastiK: do you want to look at this one since it's related to #10854?

comment:4 by bastiK, 10 years ago

Owner: changed from team to bastiK

comment:5 by bastiK, 10 years ago

Resolution: fixed
Status: newclosed

In 7935/josm:

applied #10920, applied #10854 - Move 'Toggle image thumbnail preview' feature to JOSM core (patch by holgermappt, modified)

comment:6 by bastiK, 10 years ago

I think you code would have worked without problems, as it is unusual to enable and disable thumbs loading in fast succession.

Nevertheless, I used ExecutorService to avoid having multiple background threads running at the same time. In addition, I moved the ThumbsLoader.done flag to GeoImageLayer.thumbsLoaded because it seems simpler to me (previously, the latter was set to true while the loading is still in progress).

comment:7 by Don-vip, 10 years ago

Milestone: 15.01

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain bastiK.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.