Skip to content

InexactError calling TkWinReleaseDrawableDC #88

@ncnc

Description

@ncnc

I'm trying to use Winston with latest master and I'm getting very frequent InexactErrors when calling plot, apparently due to the ccall to TkWinReleaseDrawableDC in tkwidget.jl.

The below patch doesn't fix the root cause, but makes plotting work:

diff --git a/src/tkwidget.jl b/src/tkwidget.jl
index a226e77..5f7dd93 100644
--- a/src/tkwidget.jl
+++ b/src/tkwidget.jl
@@ -373,8 +373,13 @@ function render_to_cairo(f::Function, w::TkWidget, clipped::Bool=true)
         surf = CairoWin32Surface(hdc, width(w), height(w))
         f(surf)
         destroy(surf)
-        ccall((:TkWinReleaseDrawableDC,libtk), Void, (Int, Int, Ptr{Uint8}),
-            drawable, hdc, state)
+        try
+            ccall((:TkWinReleaseDrawableDC,libtk), Void,
+              (Int, Int, Ptr{Uint8}), drawable, hdc, state)
+        catch e
+            println("Error during TkWinReleaseDrawableDC: ")
+            Base.display_error(e,catch_backtrace())
+        end
         return
     end
     error("Unsupported Operating System")

The error looks like this (relative to the patched code, sorry):

Error during TkWinReleaseDrawableDC:
ERROR: InexactError()
 in render_to_cairo at C:\Users\ncnc\.julia\v0.4\Tk\src\tkwidget.jl:377
 in anonymous at C:\Users\ncnc\.julia\v0.4\Tk\src\tkwidget.jl:395
 in jl_tcl_callback at C:\Users\ncnc\.julia\v0.4\Tk\src\tkwidget.jl:145

I'm using a fresh 32-bit windows build, but I noticed the same problem with the latest official nightly build.

julia> versioninfo()
Julia Version 0.4.0-dev+2269
Commit 65a0959 (2014-12-26 06:25 UTC)
Platform Info:
  System: Windows (i686-w64-mingw32)
  CPU: Intel(R) Core(TM)2 CPU          4300  @ 1.80GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Core2)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions