Pencil Crash on startup

Hi Guys,

I have qt 5.5.1 installed and I opened Pencil in QT IDE and app crashes on startup on StrokeManager class. mStrokeManager returns NULL in getter method. I am not sure if thats right? Can someone please help me here?

 

Ok… That got me past the loading, but as soon as I do anything it crashes again…
Seems like a ScribbleArea object needs to exist otherwise bad things happen…

 

 

Hello,
I just pulled the code down from github (for the first time) and I got the same error.
My c++ is a bit dusty, but this is a bit strange to me.

mStrokeManager is instantiated in the constructor of the ScribbleArea.
I think this is probably something that only shows up when you fireup the application for the first time.
mScribbleArea is null at this point. I added a check to only retrieve m_pStrokeManager if mScribbleArea is not null…
Since this is my first time using this app, I don’t know if it will hose something else up.

void BaseTool::initialize( Editor* editor )
{
Q_ASSERT( editor );

if ( editor == NULL )
{
qCritical( “ERROR: editor is null!” );
}
mEditor = editor;
mScribbleArea = editor->getScribbleArea();
if (mScribbleArea!= NULL)
{
m_pStrokeManager = mEditor->getScribbleArea()->getStrokeManager();
}
loadSettings();
}

Ok… I meant to edit by original post by for some reason, the edit is not popping up…

This appears to fix the problem…

The issue is being caused by a Scribble area is not assigned when mEditor->init() is called in the MainWindow2 constuctor.

this fixes it.
mEditor = new Editor( this );
mEditor->setScribbleArea(mScribbleArea);//this fixes the crash on startup
mEditor->init();

(My daughter has expressed an interest in animation, and I need a qt creator project to refresh my C++ skills, so I suppose I should get into this git thing…) (She was having problems with her Wacom tablet going all wacko with this app, so this might be a good for some dad-daughter bonding potential)

Hey @jonasthomas Thank you for taking an interest in helping to develop Pencil2D. Right now it seems our few devs are away for the holidays. Hopefully @feeef and @chchwy can shed light on this specific problem while you’re trying to work on it.

When you’re trying to edit your first post on a thread created by you, you’ll have to add the word edit to the browser link like this:

http://www.pencil2d.org/forums/topic/pencil-crash-on-startup/edit/

To edit any other post you’ll have to use the following structure where the number is the ID for each post:

http://www.pencil2d.org/forums/reply/27596/edit/

I know it’s a hassle but I can’t change it, hopefully when our admin updates the web we can change how editing posts work.

Also if it helps something I’ve done is setup tortoise svn to pull the code from github since it’s been supported on their site since a few months back. Now everytime there’s an updated version, I don’t have to redownload a zip each time.

Best of luck with your father-daughter bonding and happy holidays as well.

Thanks a lot for your help @jonasthomas !

While developing, we never launch the app “for the first time” with fresh settings so this kind of error may happen. I planned to add an issue on git about first launch settings. It is in my todo-list but I still didn’t get the time to work on it.

Don’t hesitate to contact me if you need some info about the code!

Thanks a lot @jonasthomas for your help. @feeef, where can I find the to-do list for pencil or the possible feature list that Pencil needs to be implement. I am too keen to know about building tools related to animations just like pencil is. Also helps me brush up my C++ skills. Once again, Thanks a lot all of you guys for helping me out here.

Thanks @paragdulam ! The list of things to do can be found here.

Feel free to get the code and fix, improve anything you wish. There is still a lot to do! :wink:

You can also discuss every tasks within its github page.

Well, I forked the repo, cloned it, my tiny bug fix and pushed it back to my fork and created a pull request.(Did it work?) Do you guys have guidelines on submitting fixes? If I do something more complicated, I’m thinking I should probably submit it on a branch or something?

@Jose Moreno Thanks for the tip on editing.
Quick update on the Dad-daughter thing:
My daughter had expressed an interest in animation and I ran across pencil2d after a bit of googling. We had installed it on her windows7 workstation from one of the precompiled packages and she immediately had some issues using here wacom tablet. The lines where coming out really squiggly which really frustrating her and went into the “I’m almost a teenager attitude” and wound up deleting the app and putting Adobe Illustrator on her birhday wish list (yikes).
Ok… so that’s what got me downloading the source and compiling on m 64 14.04 Ubuntu laptop. After fixing the aforementioned critter, I plugged her wacom into my laptop and it seemed it to be performing really well. I was looking at the bug list yesterday and there was an open bug complaining about loosing pressure sensitivity on the pen that I wanted to test for. I was going to add a comment that I’m not seeing it, but I can’t find that issue now, did this get closed?

Anyway… We did notice a couple of buglike issues, that I thought I ask about:
She started her first animation (bitmap) and tried saving it as the default PCLX file format. (during the save I created a special sub-folder). She did something she didn’t like and wanted to open her saved animation which came up blank… (I didn’t get any fresh demands for Adobe, but I got “the look” which is genetic trait that came from mom. Soooo… is this file not saving a known issue??

Another really annoying issue that was coming up was that when sketching the pen appeared to go invisible in some type of grid area… (Is this some type of critter with the selection tool?) I’m not sure what’s going on with… Is this a bug, or me inadvertently triggering some type of feature, I don’t understand?

 

 

@jonasthomas Hey! I think you did well, I received an email from Github with your pull, so that means it went through. The only one that can merge to the trunk is Matt though, but if he sees no problem he’ll merge it asap. Thank you for contributing to Pencil2D, even the smallest contribution is a step in the right direction!

@Jose Moreno
Cool, I’m glad that worked.

You missed my edit…

@jonasthomas You’re right I did miss your edit by a few minutes! Hmm well to me the PCLX file format is new bussiness I’m sued to the PCL one, but either way those files are in truth XML files that point the pencil engine where the required resources are lcoated. If you’ve noticed everytime you save a new folder is created alongside the file which has every file that your animation might use, usually the drawings are saved as PNG files, and there’s a .vec (for vector information) and palette files for colour information for the palette window.

The “not-saving” issue shouldn’t happen unless it’s one of the most recent nightly builds…even so the one i tested a week ago did save my animation drawings. Although the bleeding edge code I pulled today is crashing on my Qt framework, so I can’t be certain if this is a by-product of that.

The invisible grid area thing is unknown to me. You CAN make invisible lines in a vector layer to colour drawn objects without visible lines, but it doesn’t work on bitmap as far as I’m concerned. If you don’t mind would you be able to record a small video with those issues? I can recommend the open source Open Broadcast Software for that so you don’t have to use costy software.

And well…I’m a teacher as well so I want your daughter to actually experience a decent learning curve on digital drawing and animation, I’ll go against my own rules for promoting other software on the forum and recommend you Krita.

Right now it’s a really stable software, also open-source, akin to photoshop and it specializes in digital painting. The latest beta has new animation capabilities which work great for simple (no camera movements) but artsy stuff. It has both vector and bitmap capabilities incorporated.

You can download the animation beta here:

(Edit: I replaced the actual links that have the animation capabilities, the other ones are just for normal Krita, my apologies for the mistake)

32bits >> http://files.kde.org/krita/windows/krita_2.9.10.1ae_beta_x86.zip

64 bits >> http://files.kde.org/krita/windows/krita_2.9.10.1ae_beta_x64.zip

I’m linking the portable version so you don’t have to hassle yourself with installation stuff. It will work wonders with a wacom tablet. I guarantee it.

In return, hopefully you will continue to visit the site and perhaps help us from time to time with the development here, we really want Pencil to become an animation software any animator, big or small, can use. Best luck and beware “the look”, cheers!

Thanks for your help @jonasthomas !

I usually do all my bug fixing on my own fork of Pencil, on a specific branch but I always merge to master before sending my pull requests. I don’t know if it is the best workflow but it is a working one.

I didn’t have any problem saving and loading a PCLX file but as @morr suggested, you can check if the XML file and the PNG drawings are present in your saved .pclx package.

The pressure bug should be fixed now. It may have been removed from the list.

I don’t really understand what you mean about the pen stroke going invisible in a grid area ? Could you provide a screenshot of this issue if you can reproduce it?

Thank you very much anyway! :slight_smile: I can understand how frustrating it is when using a software that is not fully working as expected. I love Pencil2D in term of features and I help changing frustration in enjoyment! :slight_smile:

@feeef @jonasthomas

Hello, I quite sure the bug jonasthomas talks about is the same one that I reported here. It’s really strange behaviour and it leads to the fact that you really can’t use the move / copy / rotate tool at all because it messes up what you’re drawing.

#385

Ok @manu ! I will have a look at that!

I think I have implemented selection transform the right way so it shouldn’t be too dificult to fix.

I was also talking of having only one select tool. At the moment you can select with both the select and move tools. They don’t have exactly the same behaviour so it is very confusing.

@morr Thanks for the tip on krita. Hopefully we can get pencil2d working to suite my daughters needs. (I’m sort of familiar with the qt/ c++ environment from my dabbling with freecad so pencil2d, although looks like krita uses the qt framework also)

I was looking inside the file and it does seem that there are pngs both blank and some filled in. I think I can figure out what’s going on but I thought I ask if there is anything published describing the file structure and how it works?

Once I figure out why I’m not displaying I can bang on code related to https://github.com/pencil2d/pencil/issues/385. At the moment I need to work on some honey do projects ;(

 

 

@jonasthomas, there is no document describing the current structure of the code. However, I can give you an overview :

In term of projects, Matt has started to reorganize everything in 2 main projects.

  • app (holds everything that represents the highest level of the application with main UI. MainWindow2 being the hart of the UI)
  • core-lib (holds the “engine” of Pencil2D)

So you should mostly work in the core-lib project.

In core-lib things are organized into several sub-directories :

  • external (OS specific code)
  • graphics (The classes that represent bitmap and vector images)
  • interface (The graphical classes that are linked to the UI)
  • managers (Different managers used to handle events and data)
  • structure (Classes that handle the data within the timeline / animation engine)
  • tool (Classes that represent the tools in the toolbox)
  • util (utility methods)

canvasrenderer.cpp is not in any of these sub-directories (and should be?) but you are going to need to work on this class to fix the issue you want to fix.

I won’t go too much into details on how things work together because it would be too long. I will just tell you what is happening when you draw / transform a bitmap image on the main canvas window :

  • First of all, the selected tool class (tool/pencil.cpp) will handle the mouse / tablet events. The drawing action and data will be sent to the class ScribbleArea (interface/scribblearea.cpp) which is a QWidget that outputs the drawing.

  • While you draw your stroke, ScribbleArea will store it on a temporary image (mBufferImg) through the methods drawPencil(), drawPen()…

  • When you release the mouse or tablet, mBufferImg will be paint into the object that represent the bitmap image at the current frame through paintBitmapBuffer() and call the class CanvasRenderer through drawCanvas() to handle the final rendering).

  • CanvasRender will put together all the layers, onion skin… at the current frame.

  • Then, the magic happens back in ScribbleArea in paintEvent() where the picture generated by CanvasRenderer is displayed on the screen.

 

Now when you do a transformation, you go through a slightly different process :

  • The selection is handled by the Selection tool (tool/selecttool.cpp).

  • Although I plan to do selection and transformation with the same tool in the future, currently, the transformation is handled by the Move tool (tool/movetool.cpp) and the request for transformation is sent to the ScribbleArea within paintTransformedSelection().

  • At this point, we set CanvasRender to handle a transformation through setTransformedSelection() with the selection coordinates and the transformation data.

  • CanvasRender only generates the display of the transformation. nothing applied to the BitmapImage at the moment.

  • When calling cancelTransformedSelection() on the ScribbleArea, everything is canceled, nothing is applied to the BitmapImage and the canvas is back as it was before the transformation.

  • When calling applyTransformedSelection() on the ScribbleArea, the transformation is applied to the BitmapImage of the current frame.

I suspect this issue is coming from the fact that the transformation is not correctly canceled or applied within the CanvasRenderer. If we do an action without applying (deselect) or canceling (esc key) the transformation, the CanvasRenderer is not aware that there is no transformation to display. applyTransformedSelection() should always be called when painting or leaving the current frame.

I hope this is helpful to you! :slight_smile:
Don’t hesitate to let me know if you need more info.

So with the current master and the minor tweak that I did, It appears that there is a issue retrieving/displaying a saved file both in the pcl pclx format. I looked at the files from out the app and it appears images are stored. When loading the file it appears that something was loaded since the frame counter[?] show the correct number of boxes. So maybe it’s loading but not displaying. I tried toggling the display button, but it had no effect on showing the images… (I guess I need to find the where the load event starts and go from there.

Edit.
So… I managed to track the code down to where the error log is being generated:
BitmapImage::BitmapImage( const QString& path, const QPoint& topLeft)
{
mImage = new QImage(path);
if ( mImage->isNull() )
{
qDebug() << “ERROR: Image " << path << " not loaded”;
}
mBounds = QRect( topLeft, mImage->size() );
}
I suspect whats going on is that that “path” contains only the file name and not any path information.
I’m thinking the problem here:
void setDataDir( QString dirPath ) { mDataDirPath = dirPath; }

mDataDirPath =""
It appears the only place that this variable set is in setDataDir
setDataDir is never called… Hmmm… It’s looking like the master got pushed before the cookies where fully baked… (Sort of reminds me of what is waiting for me at work next monday) It looks like the zipped file gets unzipped into a /tmp/Pencil2d/test.Y2xD folder but somehow setDataDir is not called…)

 

I noticed in the git commit comments that there was some type of unit testing going on.
It seems like the stuff I’m running across feels like sinks being installed but the plumbing is not connected. Is this from the unit testing? Anyway, saved files where not loading. I created a bugFix branch and submitted a pull request.
https://github.com/pencil2d/pencil/pull/394

One thing I noticed is that on the color palette the color black is white. Is this a new bug or is this something that has been around for a while?

 

Ok… I really should be doing other things… But that black is white on the color palette was really annoying me. It’s a very weird bug. Is this a bug that has been around for a while?

I don’t fully understand what the issue is, but I suspect that it is occuring here:

Status ColorManager::onObjectLoaded( Object* o )
{
setColor( o->editorState()->mCurrentColor );
setColorNumber( 0 );

return Status::OK;
}

@jonasthomas Thank you for all of your time and contributions! Regarding the “black is white” behaviour it does sound strange, but I’m not able to initialize the latest pencil from source so I can’t say for sure. But by the way it sounds I’m pretty sure it’s a bug, because the color palette has always been working properly until recently.

It is a problem though that your pull requests are not getting merged, and I would also like that @chchwy could take a look at all of this thread.

He must be on vacation so I’m unsure when your progress is going to be reviewed and merged. Maybe If we ask @feeef to test this on his branch and merge it on a clone to see the difference we might get a pretty good picture of what’s happening and where.

Other than that, again thank you for dedicating so much time to this during the holidays. Happy New Year by the way :slight_smile: