bugMyPaint - Bugs: bug #20397, [possible-1.1.1] Layer moving by...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #20397: [possible-1.1.1] Layer moving by shift+mousekeys: AttributeError: 'NoneType'

Submitted by:  Libra Rian <zrzz>
Submitted on:  Tue 01 Jan 2013 08:20:34 PM UTC  
Severity: 3 - NormalPriority: 5 - Normal
Status: FixedPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Release: 1.1.0 @ master 54b81f8dPlanned Release: None
Operating System: Linux

Mon 23 Jun 2014 09:44:57 PM UTC, comment #4:

[This is a canned response, please forgive the broken formatting:
it's one of the many things
Gna! unfortunately does not do well.]

This bug tracker will shortly be moving to Github. As part of
this process, we are reviewing
old bug reports on gna.org.

This bug was marked as Fixed long ago, but was still classified
as Open. Github does not
distinguish between Fixed+Open and Fixed+Closed in the way we
once did here, so this bug is
now being marked Closed, and will not be migrated into the
github issues tracker.

If you believe that this bug still affects the most recent git
master of MyPaint (and thus
the next release), please feel free to open a new issue on Github
about it. Our new issue
trackers are:


Andrew Chadwick <achadwick>
Project Administrator
Sat 12 Jan 2013 08:39:43 AM UTC, comment #3:

Tagging as a small bugfix it might be good to backport into a 1.1.1 release, if we make one.

Andrew Chadwick <achadwick>
Project Administrator
Fri 04 Jan 2013 04:39:16 AM UTC, comment #2:

Hi - this should be fixed in https://gitorious.org/mypaint/mypaint/commit/df3afd837ebaa9794f9b0eaaa32bd7b0ae8efcf7 , and I've not been able to reproduce this problem since (I have to use very short fast drags to trigger this race condition). Conversely, sticking debug prints in leave()'s new repeated calls to self._finalize_move_idler() now shows occasional calls there at precisely the point you'd expect an exception with the old code and the right drag-fu. Good enough for me!

Also noticed exceptions from the regular in-move idle callback, so fixed that up too.

Thank you for the excellent bug report. It affects the stable release, unfortunately, so let's leave it open but "Fixed" for now.

Andrew Chadwick <achadwick>
Project Administrator
Fri 04 Jan 2013 04:07:08 AM UTC, comment #1:

Confirmed here in 1.1.0. Tricky to reproduce, but it happens if I keep trying.

Maybe the right thing is for leave() to force the outstanding move to completion early on.

Andrew Chadwick <achadwick>
Project Administrator
Tue 01 Jan 2013 08:20:34 PM UTC, original submission:

When moving layer via shift+mouse button, sometime "AttributeError: 'NoneType' object has no attribute 'model'" error can happen if move didn't finish in time and was scheduled for later.

To reproduce:

1) start mypaint
2) in preferences assign "Move Layer" to <Shift>Button3 (shift-right mouse button)
3) zoom out (zoom ~18% will suffice at my machine)
4) select big brush (e.g deevad/fill radius 6)
5) paint all over the screen. (e.g. paint giant diagonal line from top left to bottom right cornor)

Bug reproduction:
6) Press Shift
7) Click RMB to initiate moving

Next steps must be done quickly
8) move layer. Stop moving.
9) release shift key
10) release RMB

There will be error box (attach#1)

What's going on:
If movement takes too long, mypaint schedules moving to be done later. Sometimes this 'later' comes so much later, that some variables are already cleared and can't be used.

What's happening in the code:

in SpringLoadedModeMixin around gui/canvasevent.py:913
key_release_cb pops mode, around canvaseven:767 pop calls old_mode.leave(), which calls InteractionMode.leave() that clears doc at line canvasevent.py:180 [ok, that's confusing, I'll add stacktrace to the attach #2]

BUT. LayerMoveMode might be not finished with doc yet:
around canvasevent.py:1438 it calls gobject.idle_add(self._finalize_move_idler), so after a while GTK decides to finalize movement.

BUT. At that point LayerMoveMode.doc is already cleared thanks to key_release_cb/pop/leave

So basically
Attach#1: picture
Attach#2: contains two callstacks: first was gained by adding _setattr to LayerMoveMode and printing when doc changes to None

second by adding traceback.print_stack() into _finalize. As you can see _finalize_move_idler got called after

Interesting thing to note:
finalizer calls _drag_cleanup, which calls doc.modes.pop. But key_release_cb also calls doc.modes.pop(well, right now it's not a problem, since _finalizer displays error)

adding ignore_modifier=True to LayerMoveMode.__init__ seems to work
(see https://gitorious.org/~zrzz/mypaint/librarian-mypaint/commit/a59a5b7766c02e834c0af699830d3bdfa3cbfa2a )

but I have no idea what problems it might cause

Libra Rian <zrzz>


Attached Files
file #16885:  screenshot.jpg added by zrzz (42kB - image/jpeg)
file #16886:  movebug.log added by zrzz (2kB - text/x-log)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by achadwick (Posted a comment)
  • -unavailable- added by zrzz (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 23 Jun 2014 09:44:57 PM UTCachadwickOpen/ClosedOpen=>Closed
    Sat 12 Jan 2013 08:39:43 AM UTCachadwickSummaryLayer moving by shift+mousekeys: AttributeError: \'NoneType\'=>[possible-1.1.1] Layer moving by shift+mousekeys: AttributeError: 'NoneType'
    Fri 04 Jan 2013 04:39:16 AM UTCachadwickStatusConfirmed=>Fixed
    Fri 04 Jan 2013 04:07:08 AM UTCachadwickStatusNone=>Confirmed
      Releasemaster 54b81f8d158e..=>1.1.0 @ master 54b81f8d
    Tue 01 Jan 2013 08:20:34 PM UTCzrzzAttached File-=>Added screenshot.jpg, #16885
      Attached File-=>Added movebug.log, #16886
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup