Repetier-Host-Mac icon indicating copy to clipboard operation
Repetier-Host-Mac copied to clipboard

Bugs Reporting

Open lcis opened this issue 12 years ago • 16 comments

Hi,

I started using Repetier-Host Mac a couple of days ago. I like it, however sometime it crashes. What reports/infos do you need?

lcis avatar Jul 13 '12 05:07 lcis

The best is always if you can tell how to repeat the crash, so I can create and debug it. The second best is, if you compile the sources and run it in the debugger. Then you hopefully get a nice backtrace of the error (enter bt in the debug window). The last best is the stacktrace of the crash. Also always tell what you did, when the crash occurs and which hardware you are using. Looks like the crash likelyness depends on the os and computer for some errors I think I haven't found yet.

repetier avatar Jul 13 '12 06:07 repetier

Ok, I've already installed Xcode on a Mac mini for iOS-Apps developing. I'll run Repetier in debugging mode and see what happens. You'll get my feedback ASAP.

lcis avatar Jul 13 '12 08:07 lcis

...

User-Flow:

  1. Load G-Code
  2. Click Visualization
  3. Select Show single layer
  4. Increase Layer -> click on the up row a number of time (maybe too fast)
  5. Repetier -> crashes

bt

    * thread #1: tid = 0x1f07, 0x00007fff9451a06c Foundation`-[NSThread start] + 295, stop reason = EXC_BAD_ACCESS (code=13, address=0x0)
frame #0: 0x00007fff9451a06c Foundation`-[NSThread start] + 295
frame #1: 0x00000001000428a2 Repetier-Host Mac`-[GCodeView triggerViewUpdate] + 338 at GCodeView.m:172
frame #2: 0x000000010003fe5e Repetier-Host Mac`-[GCodeEditorController setShowMinLayer:] + 414 at GCodeEditorController.m:76
frame #3: 0x00007fff945b653f Foundation`_NSSetIntValueAndNotify + 259
frame #4: 0x00007fff944fdd19 Foundation`_NSSetUsingKeyValueSetter + 177
frame #5: 0x00007fff944fd7d9 Foundation`-[NSObject(NSKeyValueCoding) setValue:forKey:] + 400
frame #6: 0x00007fff9452fade Foundation`-[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 349
frame #7: 0x00007fff8d5a157e AppKit`-[NSView setValue:forKeyPath:] + 421
frame #8: 0x00007fff8d83bf43 AppKit`-[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:] + 243
frame #9: 0x00007fff8d83bab2 AppKit`-[NSBinder setValue:forBinding:error:] + 260
frame #10: 0x00007fff8dbdd26f AppKit`-[NSValueBinder _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:] + 191
frame #11: 0x00007fff8dbdcf13 AppKit`-[NSValueBinder applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:error:] + 591
frame #12: 0x00007fff8dbdc0c5 AppKit`-[NSValueBinder performAction:] + 311
frame #13: 0x00007fff8dc1def5 AppKit`-[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:] + 138
frame #14: 0x00007fff8d66be93 AppKit`-[NSControl sendAction:to:] + 57
frame #15: 0x00007fff8d66bddd AppKit`-[NSCell _sendActionFrom:] + 137
frame #16: 0x00007fff8daebf32 AppKit`-[NSStepperCell _sendActionFrom:] + 106
frame #17: 0x00007fff8d66adc9 AppKit`-[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 775
frame #18: 0x00007fff8daec10e AppKit`-[NSStepperCell trackMouse:inRect:ofView:untilMouseUp:] + 126
frame #19: 0x00007fff8d669eaa AppKit`-[NSControl mouseDown:] + 786
frame #20: 0x00007fff8d635348 AppKit`-[NSWindow sendEvent:] + 6306
frame #21: 0x00007fff8d5cea55 AppKit`-[NSApplication sendEvent:] + 5593
frame #22: 0x00007fff8d5650c6 AppKit`-[NSApplication run] + 555
frame #23: 0x00007fff8d7e1244 AppKit`NSApplicationMain + 867
frame #24: 0x0000000100006cc7 Repetier-Host Mac`main + 19927 at main.m:233
frame #25: 0x0000000100001ec4 Repetier-Host Mac`start + 52

lcis avatar Jul 13 '12 09:07 lcis

That was a good one. There is indeed a minimal chance to get this error with bad timing and thread switches.

Fix: GCodeView.m line 164:

-(void)triggerViewUpdate{ if(nextView==nil && updateViewThread==nil) {

I will it include in the next update.

repetier avatar Jul 13 '12 09:07 repetier

Wow! this was a super fast reply! thank you. I've fixed it -> OK (The line 164 is in GCodeView.m not GCodeVisual.m)

Remarks: Did you run Product->Analyze? I got 3 errors.

lcis avatar Jul 13 '12 09:07 lcis

Yes GCodeView.m would be correct. Updated the comment.

I did run analyze. The 3rd error was new and I fixed it. Is used only once the leak ist not that important. The two other with pt are no errors. I think the analyzer doesn't get this one correct. In line 271 the use of pt is no null reference and later it is???

repetier avatar Jul 13 '12 09:07 repetier

Analyze results:

GCodeVisual.m-> line 291 and line 298

    Instance variable access (via 'pt') results in a null pointer dereference

preferences.m -> line 93

    Potential leak of an object allocated on line 89 and stored into 'g'

edit: To avoid these nasty error messages I added an if-statement

    if (pt != nil) deltae = pt->e - laste;

lcis avatar Jul 13 '12 09:07 lcis

Concerning the 3rd Analyze error above:

I added following line after line 91 in Preferences.m:

    [g release];

Is this correct?

lcis avatar Jul 17 '12 08:07 lcis

Yes it's correct if you do it before assigning the new value to g.

repetier avatar Jul 17 '12 08:07 repetier

Thank you! It would be helpful if you could update the git source. This way I'll be able to pull the last changes.

lcis avatar Jul 17 '12 08:07 lcis

Ok, updated the last two fixes to github.

repetier avatar Jul 17 '12 08:07 repetier

Thanks!

I'm running Repetier-Host in debug mode. So far no more crashes!

lcis avatar Jul 17 '12 08:07 lcis

I've just installed Xcode 4.4.

error "deltae = pt->e - laste;" is now ok

There is a new one in CGodeVisual.m (line 983) , I moved the if-statement down just before line 983:

        if (liveView && path.lastDist > minHotDist)
        {
            glDisable(GL_COLOR_MATERIAL);
            glDisableClientState(GL_COLOR_ARRAY);
            //if(cp!=nil)
            //    free(cp);
        }
        if(cp!=nil)
            free(cp);
        glDisableClientState(GL_VERTEX_ARRAY);

lcis avatar Jul 26 '12 13:07 lcis

Really interesting to see how one false error report is traded against the next. Ok it is hard for the compiler to see that it was always handled correct, but to remove the message I copied the free behind the if as supposed by you.

repetier avatar Jul 26 '12 13:07 repetier

I learnt in the past that removing such errors may help building stable apps. Isn't my hobby :-)

lcis avatar Jul 26 '12 14:07 lcis

Yes indeed. When I first checked the analysis results reported were correct in most cases and removing them stopped many leaks and crashes. Some cases like the last one are hard to detect by the analyser and a small change in the if condition can easy make it a true memory leak, which is why I opted to change the code - just to be on the safe side in the future :-)

repetier avatar Jul 26 '12 14:07 repetier