Ticket #2851: scrolldata-check-thread.patch
File scrolldata-check-thread.patch, 3.0 KB (added by , 7 months ago) |
---|
-
xpra/server/window/motion.pyx
7 7 #cython: auto_pickle=False, boundscheck=False, wraparound=False, cdivision=True, language_level=3 8 8 9 9 import struct 10 import threading 10 11 11 12 from xpra.util import envbool, repr_ellipsized, csv 12 13 from xpra.log import Logger … … 60 61 self.y = y 61 62 self.width = width 62 63 self.height = height 64 self.thread = threading.current_thread() 63 65 66 def check_thread(self): 67 log("check_thread()") 68 if self.thread!=threading.current_thread(): 69 log.error("wrong thread!") 70 import traceback 71 traceback.print_stack() 72 64 73 def __repr__(self): 65 74 return "ScrollDistances(%ix%i)" % (self.width, self.height) 66 75 … … 85 94 checksum its rows into a2, 86 95 and push existing values (if we had any) into a1. 87 96 """ 97 self.check_thread() 88 98 if DEBUG: 89 99 log("%s.update%s a1=%#x, a2=%#x, distances=%#x, current size: %ix%i", self, (repr_ellipsized(pixels), x, y, width, height, rowstride, bpp), <uintptr_t> self.a1, <uintptr_t> self.a2, <uintptr_t> self.distances, self.width, self.height) 90 100 assert width>0 and height>0, "invalid dimensions: %ix%i" % (width, height) … … 133 143 The same lines may be accounted for multiple times. 134 144 The result is stored in the "distances" array. 135 145 """ 146 self.check_thread() 136 147 if DEBUG: 137 148 log("calculate(%i) a1=%#x, a2=%#x, distances=%#x", max_distance, <uintptr_t> self.a1, <uintptr_t> self.a2, <uintptr_t> self.distances) 138 149 if self.a1==NULL or self.a2==NULL: … … 180 191 * scrolls dictionary contains scroll definitions 181 192 * non-scrolls dictionary is everything else (that will need to be repainted) 182 193 """ 194 self.check_thread() 183 195 DEF MAX_MATCHES = 20 184 196 if self.a1==NULL or self.a2==NULL: 185 197 return None … … 257 269 return scrolls, line_defs 258 270 259 271 cdef match_distance(self, uint8_t *line_state, int16_t distance, const uint8_t min_line_count): 272 self.check_thread() 260 273 """ 261 274 find the lines that match the given scroll distance, 262 275 return a dictionary with the starting line as key … … 306 319 307 320 308 321 def invalidate(self, int16_t x, int16_t y, uint16_t w, uint16_t h): 322 self.check_thread() 309 323 if self.a2==NULL: 310 324 #nothing to invalidate! 311 325 return … … 335 349 336 350 337 351 def get_best_match(self): 352 self.check_thread() 338 353 if self.a1==NULL or self.a2==NULL: 339 354 return 0, 0 340 355 cdef uint16_t max_hits = 0 … … 351 366 self.free() 352 367 353 368 def free(self): 369 self.check_thread() 354 370 cdef void* ptr = <void*> self.distances 355 371 if ptr: 356 372 self.distances = NULL